Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add screenshot mode menu #131

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 41 additions & 11 deletions .config/sway/config.d/50-openSUSE.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,53 @@ bindsym --no-warn XF86AudioPlay exec playerctl play-pause
bindsym --no-warn XF86AudioNext exec playerctl next
bindsym --no-warn XF86AudioPrev exec playerctl previous

## Screenshots
# Area selection shortcuts
# Screenshots
## Area selection shortcuts
set $selected_window swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp
set $focused_window swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'
set $focused_output swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name'
# Screenshot commands
## Screenshot commands
### Full
set $screenshot_full grim
set $screenshot_focused_output grim -o $($focused_output)
set $screenshot_focused_window $focused_window | grim -g-
set $screenshot_full_clipboard grim - | wl-copy
### Selected window
set $screenshot_selected_window $selected_window | grim -g-
set $screenshot_selected_window_clipboard $selected_window | grim -g- - | wl-copy
### Selected area
set $screenshot_selected_area slurp | grim -g-
# Screenshot keybindings
bindsym Print exec $screenshot_full
bindsym $mod+Print exec $screenshot_focused_output
bindsym Shift+Print exec $screenshot_focused_window
bindsym Mod1+Print exec $screenshot_selected_window
bindsym Ctrl+Print exec $screenshot_selected_area
set $screenshot_selected_area_clipboard slurp | grim -g- - | wl-copy
### Focused window
set $screenshot_focused_window $focused_window | grim -g-
set $screenshot_focused_window_clipboard $focused_window | grim -g- - | wl-copy
### Focused output
set $screenshot_focused_output grim -o $($focused_output)
set $screenshot_focused_output grim -o $($focused_output) - | wl-copy

## Screenshot mode menu
set $screenshot "Screenshot: (f) full, (s) select window, (a) select area, (w) focused window, (o) focused output [Ctrl+ saves to clipboard]"
mode $screenshot {
# Full
bindsym f exec $screenshot_full; mode "default"
bindsym Ctrl+f exec $screenshot_full_clipboard; mode "default"
# Selected window
bindsym s exec $screenshot_selected_window; mode "default"
bindsym Ctrl+s exec $screenshot_selected_window_clipboard; mode "default"
# Selected area
bindsym a exec $screenshot_selected_area; mode "default"
bindsym Ctrl+a exec $screenshot_selected_area_clipboard; mode "default"
# Focused window
bindsym w exec $screenshot_focused_window; mode "default"
bindsym Ctrl+w exec $screenshot_focused_window_clipboard; mode "default"
# Focused output
bindsym o exec $screenshot_focused_output; mode "default"
bindsym Ctrl+o exec $screenshot_focused_output_clipboard; mode "default"

# Exit screenshot mode menu
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+Print mode "default"
}
bindsym $mod+Print mode $screenshot

#
# Status Bar:
Expand Down