i3: move screenshot to an helper script

This commit is contained in:
Vincent Bernat 2021-08-08 13:18:49 +02:00
parent 34946de658
commit e4a5aa99e8
2 changed files with 19 additions and 2 deletions

17
bin/screenshot Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -euf -o pipefail
case $1 in
desktop)
target=~/.config/i3/screenshots/$(date -Iseconds).jpg
maim -u -m 8 $target
notify-send -i camera-photo "Desktop screenshot" "Saved in ${target##*/}"
echo -n $target | xclip -selection clipboard
;;
window)
maim -u -s -b 5 -l -c 0.3,0.4,0.6,0.4 \
| xclip -selection clipboard -t image/png
notify-send -i camera-photo "Screenshot" "Saved to clipboard"
;;
esac

4
config
View file

@ -138,8 +138,8 @@ bindsym $mod+Shift+r restart
# Lock screen and print screen
bindsym XF86ScreenSaver exec --no-startup-id exec xset s activate
bindsym $mod+Delete exec --no-startup-id exec xset s activate
bindsym Print exec --no-startup-id "maim -u -s -b 5 -l -c 0.3,0.4,0.6,0.4 | xclip -selection clipboard -t image/png"
bindsym $mod+Print exec --no-startup-id "maim -u -m 8 ~/.config/i3/screenshots/$(date -Iseconds).jpg"
bindsym Print exec --no-startup-id exec ~/.config/i3/bin/screenshot window
bindsym $mod+Print exec --no-startup-id exec ~/.config/i3/bin/screenshot desktop
# Quake window
bindsym $mod+grave nop "quake-console:$term:QuakeConsoleNeedsUniqueName:0.3"