add screenshot swappy argument

This commit is contained in:
piotr 2023-11-15 01:44:18 +01:00
parent 89e3af0b9b
commit da27b893d2
3 changed files with 9 additions and 5 deletions

View File

@ -124,7 +124,7 @@ bind = $mainMod, D, layoutmsg, cyclenext # (master)
bind = , Print, exec, screenshot fullscreen # full screen
bind = CONTROL, Print, exec, screenshot display # focused display
bind = $mainMod SHIFT+CONTROL, Print, exec, screenshot focused # focused window
bind = SHIFT+CONTROL, Print, exec, grim -g "$(slurp)" - | swappy -f - # selected region -> swappy
bind = SHIFT+CONTROL, Print, exec, screenshot swappy # selected region -> swappy
# bind = SHIFT+CONTROL, Print, exec, screenshot region # or selected region w/o swappy
# MOVE FOCUS with mainMod + arrow keys

View File

@ -80,7 +80,7 @@ bindsym $Mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut.
# screenshot
bindsym Print exec screenshot fullscreen
bindsym Control+Print exec screenshot display
bindsym Shift+Control+Print exec grim -g "$(slurp)" - | swappy -f -
bindsym Shift+Control+Print exec screenshot swappy
bindsym $Mod+Shift+Control+Print exec screenshot focused
# audio

View File

@ -24,7 +24,7 @@ CHOICE=$1
# Since the script errors out when a $CHOICE isn't supplied
if [[ -z "$CHOICE" ]]; then
echo "Usage: $0 [fullscreen|region|focused|display]"
echo "Usage: $0 [fullscreen|region|focused|display|swappy]"
exit 1
fi
@ -40,6 +40,7 @@ if [[ -n "$SWAY" ]]; then
region) grim -g "$(slurp)" "$FILENAME" ;;
focused) grim -g "$FOCUSED" "$FILENAME" ;;
display) grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')" "$FILENAME" ;;
swappy) grim -g "$(slurp)" - | swappy -f - ;;
esac
fi
@ -51,8 +52,11 @@ if [[ -n "$HYPR" ]]; then
region) grim -g "$(slurp)" "$FILENAME" ;;
focused) grim -g "$FOCUSED" "$FILENAME" ;;
display) grim -o "$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')" "$FILENAME" ;;
swappy) grim -g "$(slurp)" - | swappy -f - ;;
esac
fi
wl-copy < "$FILENAME"
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$FILENAME"
if [ "$CHOICE" != "swappy" ]; then
wl-copy < "$FILENAME"
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$FILENAME"
fi