diff options
| -rwxr-xr-x | 2flac | 24 | ||||
| -rwxr-xr-x | ag-preview | 18 | ||||
| -rwxr-xr-x | reword | 2 | ||||
| -rwxr-xr-x | screenshot-tool | 23 |
4 files changed, 67 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#!/bin/bash +# Convert APE (Monkey Audio Format) to FLAC using ffmpeg. + +set -euo pipefail + +usage() { + echo "Usage: $(basename "$0") [input file]..." + echo "Converts input files into FLAC format." + exit 0 +} + +main() { + if [ $# = 0 ]; then + usage + fi + for input in "$@"; do + if [ -f "$input" ]; then + output="${input%.*}.flac" + ffmpeg -loglevel error -hide_banner -i "$input" -acodec flac "$output" + fi + done +} + +main "$@" diff --git a/ag-preview b/ag-preview new file mode 100755 index 0000000..e210682 --- /dev/null +++ b/ag-preview @@ -0,0 +1,18 @@ +#!/bin/bash +# Based on https://github.com/junegunn/fzf/blob/master/ADVANCED.md#ripgrep-integration + +set -euo pipefail + +main() { + AG_PREFIX="ag --column --numbers --noheading --color --smart-case" + INITIAL_QUERY="${*:-}" + : | fzf --ansi --disabled --query "$INITIAL_QUERY" \ + --bind "start:reload:$AG_PREFIX {q}" \ + --bind "change:reload:sleep 0.1; $AG_PREFIX {q} || true" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' +} + +main "$@" @@ -0,0 +1,2 @@ +#!/bin/sh +git commit --amend -m "$*" diff --git a/screenshot-tool b/screenshot-tool new file mode 100755 index 0000000..30017da --- /dev/null +++ b/screenshot-tool @@ -0,0 +1,23 @@ +#!/bin/bash +# Fix issue: window loose focus after flameshot + +set -euo pipefail + +flameshot_run() { + focused_window=$(xdotool getwindowfocus) + flameshot gui || true + if [ "$focused_window" != "$(xdotool getwindowfocus)" ]; then + xdotool windowactivate "$focused_window" + fi +} + +main() { + if command -v flameshot >/dev/null 2>&1; then + flameshot_run "$@" + else + echo "No flameshot command found" + exit 1 + fi +} + +main "$@" |
