From 29ad53d3a19befba1d22544b2fe6d52768606045 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 20 May 2021 20:11:02 +0200 Subject: [PATCH] chore(sway): screenshot stuff updates --- .config/sway/config | 3 ++- bin/winprint.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 bin/winprint.sh diff --git a/.config/sway/config b/.config/sway/config index 79d0a37..92145c2 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -200,8 +200,9 @@ assign [class="vlc"] M bindsym { - print exec grim $(xdg-user-dir PICTURES)/grim-$(date +'%Y-%m-%dT%H-%M-%S').png + print exec grim $(xdg-user-dir PICTURES)/screenshots/grim-$(date +'%Y-%m-%dT%H-%M-%S').png Shift+print exec grim -g "$(slurp)" - | wl-copy + Control+print exec winprint.sh $mod+c exec gnome-calculator $mod+n exec nemo $mod+m exec QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_QPA_PLATFORMTHEME=wayland vlc diff --git a/bin/winprint.sh b/bin/winprint.sh new file mode 100755 index 0000000..debc294 --- /dev/null +++ b/bin/winprint.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# taken from https://github.com/swaywm/sway/blob/12e223e7973f7d7132d95c6302328067dec732ce/contrib/grimshot +FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)') +GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"') +grim -g "$GEOM" - | wl-copy