summaryrefslogtreecommitdiff
path: root/nsxiv/exec/key-handler
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2025-03-07 00:22:08 +0200
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2025-03-07 00:22:08 +0200
commit6e968354e4f9cad9f94b592e61a09b17a8e06210 (patch)
treedf0f341fd9332b53a39aa72c4be17cdd0f7cd1c4 /nsxiv/exec/key-handler
parent40577b3f22f677c45525e7439f689a482eedbf69 (diff)
Great new changes to X11, allacrity(just for testing), btop, nsxiv
(added key exec handler), nvim, tmux niceness, zathura configuration massive zsh improvements. Overall a solid update, install script is still dead tho. REGARDLESS: Changes to be committed: modified: X11/xinit new file: alacritty/alacritty.toml modified: btop/btop.conf new file: nsxiv/exec/key-handler modified: nvim/init.vim new file: sxiv modified: tmux/tmux.conf modified: zathura/zathurarc modified: zsh/aliases modified: zsh/env modified: zsh/zshrc
Diffstat (limited to 'nsxiv/exec/key-handler')
-rwxr-xr-xnsxiv/exec/key-handler52
1 files changed, 52 insertions, 0 deletions
diff --git a/nsxiv/exec/key-handler b/nsxiv/exec/key-handler
new file mode 100755
index 0000000..0875061
--- /dev/null
+++ b/nsxiv/exec/key-handler
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# you use these inside nsxiv with Ctrl+x and then the key for an action
+
+# w: set as wallpaper
+# c: copy File
+# m: move file
+# r: rotate 90 degrees
+# R: rotate -90 degrees
+# f: flip
+# y: copy file path to clipboard
+# Y: copy file path to clipboard with full path
+# d: delete File
+# g: open with gimp
+# k: open with krita
+# i: show file information
+
+dmenu_config=$(bash ~/.config/dmenu.conf)
+
+while read -r file
+do
+case "$1" in
+ "w") feh --bg-fill --no-fehbg "$file" & ;;
+ "c")
+ [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | $dmenu_config -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." &
+ ;;
+ "m")
+ [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | $dmenu_config -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" ;;
+ "f")
+ magick "$file" -flop "$file" ;;
+ "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" & ;;
+ "d")
+ [ "$(printf "No\\nYes" | $dmenu_config -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
+ "g") setsid -f gimp "$file" ;;
+ "k") setsid -f krita "$file" ;;
+ "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;;
+esac
+done