aboutsummaryrefslogtreecommitdiff
path: root/.config/swayimg
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-11-14 23:43:38 +0300
committerawy <awy@awy.one>2025-11-14 23:43:38 +0300
commitc7a88a07b9287db9c129914483f6b3ae1ab5404c (patch)
tree73c227c5e8519eb9135f46984e4fc067b316ed1b /.config/swayimg
downloadmangoslice-c7a88a07b9287db9c129914483f6b3ae1ab5404c.tar.gz
init
Diffstat (limited to '.config/swayimg')
-rw-r--r--.config/swayimg/config38
-rwxr-xr-x.config/swayimg/key-handler35
2 files changed, 73 insertions, 0 deletions
diff --git a/.config/swayimg/config b/.config/swayimg/config
new file mode 100644
index 0000000..68a1650
--- /dev/null
+++ b/.config/swayimg/config
@@ -0,0 +1,38 @@
+[general]
+overlay = no
+[viewer]
+window = #000000
+scale = fit
+[gallery]
+window = #000000
+[list]
+all = yes
+[keys.viewer]
+h = step_left
+j = step_down
+k = step_up
+l = step_right
+n = next_file
+p = prev_file
+w = zoom fit
+g = first_file
+Shift+g = last_file
+Ctrl+x = exec ~/.config/swayimg/key-handler "%"
+r = rotate_right
+Shift+r = rotate_left
+Alt+Shift+k = zoom +20
+Alt+Shift+j = zoom -20
+[keys.gallery]
+h = step_left
+j = step_down
+k = step_up
+l = step_right
+g = first_file
+Shift+g = last_file
+[info]
+info_timeout = 0
+[info.viewer]
+top_left = none
+top_right = none
+bottom_left = +name
+bottom_right = +scale,+frame,+index
diff --git a/.config/swayimg/key-handler b/.config/swayimg/key-handler
new file mode 100755
index 0000000..b28e4f6
--- /dev/null
+++ b/.config/swayimg/key-handler
@@ -0,0 +1,35 @@
+#!/bin/sh
+file=$1
+[ -z "$selection" ] && selection=$(printf "w - Set as wallpaper\nc - Copy to dir\nm - Move to dir\nr - Rotate 90°\nR - Rotate -90°\nf - Flip horizontal\ny - Copy filename to clipboard\nY - Copy full path to clipboard\nd - Delete\ng - Open in GIMP\ni - Show media info" |
+ mew -i -l 12 -p "Choose action for selected files:")
+action=$(printf "%s" "$selection" | cut -d'-' -f1 | tr -d ' ')
+case "$action" in
+ "w") setbg "$file" & ;;
+ "c")
+ [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | mew -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}' | mew -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' | wl-copy &&
+ notify-send "$file copied to clipboard" & ;;
+ "Y")
+ readlink -f "$file" | tr -d '\n' | wl-copy &&
+ notify-send "$(readlink -f "$file") copied to clipboard" & ;;
+ "d")
+ [ "$(printf "No\\nYes" | mew -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
+ "g") ifinstalled gimp && setsid -f gimp "$file" ;;
+ "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | rg "<b>")" ;;
+ *) notify-send "No keybind for that key" ;;
+esac