aboutsummaryrefslogtreecommitdiff
path: root/config/sway/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2026-01-30 13:51:05 +0100
committerKarel Kočí <cynerd@email.cz>2026-01-30 13:51:05 +0100
commite838cd7517339d33c59094e80abe382c2725c4af (patch)
tree49c83431f83f75eda63645bcdd6fe9e98f970e0d /config/sway/scripts
parentf851139afd5ca3969bdb90effa4bea349b798459 (diff)
downloadmyconfigs-e838cd7517339d33c59094e80abe382c2725c4af.tar.gz
myconfigs-e838cd7517339d33c59094e80abe382c2725c4af.tar.bz2
myconfigs-e838cd7517339d33c59094e80abe382c2725c4af.zip
swaywm: tools improvements
Diffstat (limited to 'config/sway/scripts')
-rwxr-xr-xconfig/sway/scripts/screenshot19
1 files changed, 19 insertions, 0 deletions
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