From adfb1490848d10cac9f34c7fda0184567ebe2733 Mon Sep 17 00:00:00 2001 From: frosty Date: Mon, 29 Jul 2024 04:19:39 -0400 Subject: [PATCH] (nsxiv): make key handler more concise and update reference to wallpaper set script --- .config/nsxiv/exec/key-handler | 38 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.config/nsxiv/exec/key-handler b/.config/nsxiv/exec/key-handler index 266dbea..4fdd6a8 100755 --- a/.config/nsxiv/exec/key-handler +++ b/.config/nsxiv/exec/key-handler @@ -1,28 +1,16 @@ #!/bin/sh -copy() { - file="$1" - - file_ext="${file##*.}" - case "$file_ext" in - "png") - copy_path="$file" - ;; - *) - file_name="${file##*/}" - file_base="${file_base%%.*}" - copy_path="/tmp/copy_$file_base.png" - ;; - esac - - xclip -sel clip -t image/png "$file" - notify-send "nsxiv" "Copied $copy_path to the clipboard." -} - -while read -r file; do - case "$1" in - w) wallpaper "$file" ;; - e) gimp "$file" ;; - y) copy "$file" ;; - esac +while IFS= read -r file; do + case "$1" in + w) + wallpaper-set "$file" + ;; + e) + setsid -f gimp "$file" + ;; + y) + xclip -sel clip -t image/png "$file" + notify-send "nsxiv" "Copied ${file##*/} to the clipboard." + ;; + esac done