From 3309392b6dfb6ec780c279ead9fdd82b78b1741d Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Tue, 21 May 2024 21:56:31 +0000 Subject: [PATCH] sway: write a bad one-liner --- home/sway.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/sway.nix b/home/sway.nix index 49b7c15..cf44128 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -83,6 +83,9 @@ in "${mod}+k" = "move workspace to right"; "${mod}+l" = "exec swaylock"; "${mod}+Mod1+e" = "exec wofi-emoji"; + + "${mod}+Mod1+q" = "kill"; + # Sink 0 means the default AIUI "XF86AudioRaiseVolume" = "exec pactl set-sink-volume 0 +5%"; "Shift+XF86AudioRaiseVolume" = "exec pactl set-sink-volume 0 +1%"; @@ -93,8 +96,13 @@ in "Shift+XF86MonBrightnessUp" = "exec light -A 1"; "XF86MonBrightnessDown" = "exec light -U 5"; "Shift+XF86MonBrightnessDown" = "exec light -U 1"; - "Print" = ''exec grim "$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')"''; - "Shift+Print" = ''exec grim -g "$(slurp)" "$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')"''; + + # sorry + "Print" = ''exec ${pkgs.writeScript "bad-screenshot" '' + grim -g "$(swaymsg -t get_tree | jq -r '.. | .nodes? | .[]? | . as $parent | .nodes[] | select(.pid? and .visible?) | "\($parent.rect.x + .deco_rect.x),\($parent.rect.y + .deco_rect.y) \(.rect.width)x\(.rect.height + .deco_rect.height)"' | slurp -r -o)" "$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')" + ''}''; + "Shift+Print" = ''exec grim -g "$(slurp -d)" "$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')"''; + "Mod1+Print" = ''exec grim "$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')"''; } // extraGotoBindings // extraMoveBindings