Skip to content

Commit

Permalink
add screenshot swappy argument
Browse files Browse the repository at this point in the history
  • Loading branch information
nwg-piotr committed Nov 15, 2023
1 parent 89e3af0 commit da27b89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nwg_shell/skel/config/hypr/hyprland.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nwg_shell/skel/config/sway/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions scripts/screenshot
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

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

0 comments on commit da27b89

Please sign in to comment.