aboutsummaryrefslogtreecommitdiff
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
parentf851139afd5ca3969bdb90effa4bea349b798459 (diff)
downloadmyconfigs-e838cd7517339d33c59094e80abe382c2725c4af.tar.gz
myconfigs-e838cd7517339d33c59094e80abe382c2725c4af.tar.bz2
myconfigs-e838cd7517339d33c59094e80abe382c2725c4af.zip
swaywm: tools improvements
-rw-r--r--config/sway/bindsym-system8
-rw-r--r--config/sway/daemons1
-rwxr-xr-xconfig/sway/scripts/screenshot19
m---------private0
4 files changed, 25 insertions, 3 deletions
diff --git a/config/sway/bindsym-system b/config/sway/bindsym-system
index 7afcb4c..79094be 100644
--- a/config/sway/bindsym-system
+++ b/config/sway/bindsym-system
@@ -13,10 +13,12 @@ mode "$mode_system" {
bindsym $mod+Shift+q mode "$mode_system"
-set $screenshot Screenshot: (s)elect or (d)desktop
+set $screenshot Screenshot: (s)elect or (w)indow or (o)tput or (d)desktop
mode "$screenshot" {
- bindsym --release d exec --no-startup-id grim, mode "default"
- bindsym --release s exec --no-startup-id sh -c "slurp | grim -g -", mode "default"
+ bindsym --locked s exec --no-startup-id ~/.config/sway/scripts/screenshot select, mode "default"
+ bindsym --locked w exec --no-startup-id ~/.config/sway/scripts/screenshot window, mode "default"
+ bindsym --locked o exec --no-startup-id ~/.config/sway/scripts/screenshot output, mode "default"
+ bindsym --locked d exec --no-startup-id ~/.config/sway/scripts/screenshot desktop, mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
diff --git a/config/sway/daemons b/config/sway/daemons
index cc3e3ed..a6579da 100644
--- a/config/sway/daemons
+++ b/config/sway/daemons
@@ -8,3 +8,4 @@ exec --no-startup-id {
for_window [class="Ferdi"] move scratchpad
exec ferdium
+exec sh -c 'if commad -v openrgb >/dev/null; then exec openrgb --startminimized; fi'
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
diff --git a/private b/private
-Subproject f2f279e7aa71f2b72f34ad8ec5100725d24d8b9
+Subproject abe80caafee87d3111f52d3e7a01f3869d2cfc3