From b17369a43b2b777e32129cefcde48e853c157377 Mon Sep 17 00:00:00 2001 From: King of the light Date: Fri, 9 Feb 2024 13:30:52 +0100 Subject: [PATCH] Add name for saved screenshots Add a variable that contains the path and name for screenshots to be saved. --- .config/sway/config.d/50-openSUSE.conf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.config/sway/config.d/50-openSUSE.conf b/.config/sway/config.d/50-openSUSE.conf index 251dad5..223496f 100644 --- a/.config/sway/config.d/50-openSUSE.conf +++ b/.config/sway/config.d/50-openSUSE.conf @@ -50,25 +50,27 @@ bindsym --no-warn XF86AudioNext exec playerctl next bindsym --no-warn XF86AudioPrev exec playerctl previous # Screenshots +## Screenshot file path +set $screenshot_dir $(xdg-user-dir PICTURES)/$(date +%Y-%m-%d_%H-%M-%S).png ## 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 ### Full -set $screenshot_full grim +set $screenshot_full grim $screenshot_dir set $screenshot_full_clipboard grim - | wl-copy ### Selected window -set $screenshot_selected_window $selected_window | grim -g- +set $screenshot_selected_window $selected_window | grim -g- $screenshot_dir set $screenshot_selected_window_clipboard $selected_window | grim -g- - | wl-copy ### Selected area -set $screenshot_selected_area slurp | grim -g- +set $screenshot_selected_area slurp | grim -g- $screenshot_dir set $screenshot_selected_area_clipboard slurp | grim -g- - | wl-copy ### Focused window -set $screenshot_focused_window $focused_window | grim -g- +set $screenshot_focused_window $focused_window | grim -g- $screenshot_dir 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) $screenshot_dir set $screenshot_focused_output_clipboard grim -o $($focused_output) - | wl-copy ## Screenshot mode menu