From e4a5aa99e863f47aa9aac9640778b6719ef3f745 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 8 Aug 2021 13:18:49 +0200 Subject: [PATCH] i3: move screenshot to an helper script --- bin/screenshot | 17 +++++++++++++++++ config | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 bin/screenshot diff --git a/bin/screenshot b/bin/screenshot new file mode 100755 index 0000000..4781296 --- /dev/null +++ b/bin/screenshot @@ -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 diff --git a/config b/config index c2cb199..15b027b 100644 --- a/config +++ b/config @@ -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"