aboutsummaryrefslogtreecommitdiff
path: root/config/sway/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'config/sway/scripts')
-rwxr-xr-xconfig/sway/scripts/notes2
-rwxr-xr-xconfig/sway/scripts/pass6
-rwxr-xr-xconfig/sway/scripts/screenshot19
3 files changed, 23 insertions, 4 deletions
diff --git a/config/sway/scripts/notes b/config/sway/scripts/notes
index ebe2684..8f025fb 100755
--- a/config/sway/scripts/notes
+++ b/config/sway/scripts/notes
@@ -1,5 +1,5 @@
#!/bin/sh
cd ~/notes
find * -type f | wofi -d -p 'notes' | while read -r note; do
- nohup alacritty -e vim ~/notes/"$note" >/dev/null 2>&1 &
+ nohup alacritty -e nvim ~/notes/"$note" >/dev/null 2>&1 &
done
diff --git a/config/sway/scripts/pass b/config/sway/scripts/pass
index 06383b3..11700e6 100755
--- a/config/sway/scripts/pass
+++ b/config/sway/scripts/pass
@@ -1,6 +1,6 @@
#!/bin/sh
-find ~/.password-store -name .git -prune -o -type f -printf '%P\n' | \
- sed 's/\.gpg$//' | wofi -d -p 'Pass:' | \
+find ~/.password-store -name .git -prune -o -type f -printf '%P\n' |
+ sed 's/\.gpg$//' | wofi -d -p 'Pass:' |
while read -r psw; do
pass -c "$psw"
-done
+ done
diff --git a/config/sway/scripts/screenshot b/config/sway/scripts/screenshot
new file mode 100755
index 0000000..45086f1
--- /dev/null
+++ b/config/sway/scripts/screenshot
@@ -0,0 +1,19 @@
+#!/bin/sh
+case "${1:-}" in
+desktop)
+ exec grim
+ ;;
+output)
+ exec grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')"
+ ;;
+window)
+ exec grim -g "$(swaymsg -t get_tree |
+ jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')"
+ # TODO the second variant is newer but doesn't work with my version of sway
+ exec grim -T "$(swaymsg -t get_tree |
+ jq -j '.. | select(.type?) | select(.focused).foreign_toplevel_identifier')"
+ ;;
+select)
+ exec grim -g "$(slurp)"
+ ;;
+esac