feat(screenshots): add swappy, add screenshot scripts and keybindings

* Add [swappy](https://github.com/jtheoof/swappy) for handling screenshots. It's a nice Flameshot-like tool that allows adding simple annotations (drawing circles, arrows, text, etc) to screenshots and can save to file or pass to the clipboard.
* Add keybindings for "snip", screenshot window, and screenshot current display.
* Add scripts for the screenshot window and screenshot current display functions.
* `packages-repository.txt` has also been alphabetically sorted to make it easier to work with.
This commit is contained in:
BluishHumility
2024-07-29 22:00:22 -04:00
parent 3a74020703
commit 678c3a1fcb
5 changed files with 14 additions and 20 deletions

View File

@@ -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
#

View File

@@ -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

View File

@@ -0,0 +1,4 @@
#!/bin/bash
output_id=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused).name')
grim -o $output_id - | swappy -f -

View File

@@ -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 -