diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-03-09 22:03:28 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-03-09 22:03:28 +0900 |
| commit | 1853f713625558299d5e8982b9d2a8d0ff2dbc8d (patch) | |
| tree | c089596b8c5052dd827c39813572b635c76d89f2 /ar/.config/nsxiv/exec/key-handler | |
| parent | 56df043d5906aac93e4345528c5f9a6541f5b14e (diff) | |
updates
Diffstat (limited to 'ar/.config/nsxiv/exec/key-handler')
| -rwxr-xr-x | ar/.config/nsxiv/exec/key-handler | 94 |
1 files changed, 44 insertions, 50 deletions
diff --git a/ar/.config/nsxiv/exec/key-handler b/ar/.config/nsxiv/exec/key-handler index fc48110..a315b02 100755 --- a/ar/.config/nsxiv/exec/key-handler +++ b/ar/.config/nsxiv/exec/key-handler @@ -1,9 +1,9 @@ #!/bin/sh while read -r file; do - case "$1" in - "h") - notify-send "Macro <C-x> key bindings:" "\- b: Set as wallpaper + case "$1" in + "h") + notify-send "Macro <C-x> key bindings:" "\- b: Set as wallpaper - c: Copy file - d: Delete file - h: Help key bindings @@ -17,51 +17,45 @@ while read -r file; do - S: Change resolution - y: Copy file name to clipboard - Y: Copy file path to clipboard" & - ;; - "b") setbg "$file" & ;; - "c") - [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit - cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & - ;; - "d") - [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." - ;; - "f") - magick "$file" -flop "$file" - ;; - "g") ifinstalled gimp && setsid -f gimp "$file" ;; - "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;; - "m") - [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit - mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & - ;; - "r") - magick "$file" -rotate 90 "$file" - ;; - "R") - magick "$file" -rotate -90 "$file" - ;; - "s") - size="$(echo "" | dmenu -i -p "Enter a size to resize $file ($(identify -format "%wx%h" $file)): ")" - magick "$file" -resize "$size" "$file" && notify-send "$file size has changed to $size." - ;; - "S") - resolution="$(printf low\\nmedium\\nhigh | dmenu -i -p "Choose a resolution: ")" - case "$resolution" in - low) magick "$file" -resample 72 "$file" ;; - medium) magick "$file" -resample 150 "$file" ;; - high) magick "$file" -resample 300 "$file" ;; - esac && notify-send "Changed $file resolution to $resolution." - ;; - "y") - printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard && - notify-send "$file copied to clipboard" & - ;; - "Y") - readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && - notify-send "$(readlink -f "$file") copied to clipboard" & - ;; - esac + ;; + "b") setbg "$file" & ;; + "c") + [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & + ;; + "d") + [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." + ;; + "f") magick "$file" -flop "$file" ;; + "g") ifinstalled gimp && setsid -f gimp "$file" ;; + "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;; + "m") + [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & + ;; + "r") magick "$file" -rotate 90 "$file" ;; + "R") magick "$file" -rotate -90 "$file" ;; + "s") + size="$(echo "" | dmenu -i -p "Enter a size to resize $file ($(identify -format "%wx%h" $file)): ")" + magick "$file" -resize "$size" "$file" && notify-send "$file size has changed to $size." + ;; + "S") + resolution="$(printf low\\nmedium\\nhigh | dmenu -i -p "Choose a resolution: ")" + case "$resolution" in + low) magick "$file" -resample 72 "$file" ;; + medium) magick "$file" -resample 150 "$file" ;; + high) magick "$file" -resample 300 "$file" ;; + esac && notify-send "Changed $file resolution to $resolution." + ;; + "y") + printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$file copied to clipboard" & + ;; + "Y") + readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & + ;; + esac done |
