make screenshots save to folder too

This commit is contained in:
Ivan Dimitrov 2023-11-06 17:22:21 +02:00
parent 797cf3363e
commit 62efd071d1
2 changed files with 23 additions and 2 deletions

View File

@ -26,8 +26,8 @@ floating_modifier $mod normal
bindsym $mod+Shift+r reload bindsym $mod+Shift+r reload
# Take screenshot of area and screen respectively # Take screenshot of area and screen respectively
bindsym $mod+Shift+s exec grim -g "$(slurp)" - | wl-copy bindsym $mod+Shift+a exec screenshot area
bindsym $mod+Shift+a exec grim - | wl-copy bindsym $mod+Shift+s exec screenshot
# Lock screen # Lock screen
bindsym Alt+Shift+l exec swaylock bindsym Alt+Shift+l exec swaylock

21
scripts/bin/screenshot Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
ss_dir="$(xdg-user-dir PICTURES)/ss"
pic_dir="$ss_dir/$(date +%s).png"
mkdir -p "$ss_dir"
capture_area() {
grim -g "$(slurp)" "$pic_dir" && wl-copy "$pic_dir"
}
capture_screen() {
grim "$pic_dir" && wl-copy "$pic_dir"
}
if [[ "$1" = "area" ]]; then
capture_area
else
capture_screen
fi