diff --git a/.config/sway/config.d/default b/.config/sway/config.d/default index 4cf2cb6..75ef7d2 100644 --- a/.config/sway/config.d/default +++ b/.config/sway/config.d/default @@ -219,8 +219,12 @@ bindsym $mod+r mode "resize" # # Screenshots # - bindsym print exec /usr/share/sway-contrib/grimshot --notify save output - bindsym Shift+print exec ~/.config/sway/scripts/screenshot.sh + # Snip a selection and pipe to swappy + bindsym print exec grim -g "$(slurp)" - | swappy -f - + # Screenshot a window and pipe to swappy + bindsym Ctrl+Print exec ~/.config/sway/scripts/screenshot_window.sh + # Screenshot the current display and pipe to swappy + bindsym Shift+Print exec ~/.config/sway/scripts/screenshot_display.sh # # Keybindings List # diff --git a/.config/sway/scripts/screenshot.sh b/.config/sway/scripts/screenshot.sh deleted file mode 100644 index 75b836d..0000000 --- a/.config/sway/scripts/screenshot.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -entries="Active Screen Output Area Window" - -selected=$(printf '%s\n' $entries | wofi --style=$HOME/.config/wofi/style.widgets.css --conf=$HOME/.config/wofi/config.screenshot | awk '{print tolower($1)}') - -case $selected in - active) - /usr/share/sway-contrib/grimshot --notify save active;; - screen) - /usr/share/sway-contrib/grimshot --notify save screen;; - output) - /usr/share/sway-contrib/grimshot --notify save output;; - area) - /usr/share/sway-contrib/grimshot --notify save area;; - window) - /usr/share/sway-contrib/grimshot --notify save window;; -esac diff --git a/.config/sway/scripts/screenshot_display.sh b/.config/sway/scripts/screenshot_display.sh new file mode 100755 index 0000000..5b50f5e --- /dev/null +++ b/.config/sway/scripts/screenshot_display.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +output_id=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused).name') +grim -o $output_id - | swappy -f - diff --git a/.config/sway/scripts/screenshot_window.sh b/.config/sway/scripts/screenshot_window.sh new file mode 100755 index 0000000..9b58a1c --- /dev/null +++ b/.config/sway/scripts/screenshot_window.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" - | swappy -f - diff --git a/packages-repository.txt b/packages-repository.txt index c0f5ae5..880cb0e 100644 --- a/packages-repository.txt +++ b/packages-repository.txt @@ -38,3 +38,4 @@ xed ttf-jetbrains-mono ttf-ubuntu-font-family xfce4-terminal +swappy