From ffb62ab7149477c203735c21adbc2afea83c6cfc Mon Sep 17 00:00:00 2001 From: samedamci Date: Mon, 1 Jun 2020 08:26:03 +0200 Subject: [PATCH] Add --force_area option to screenshot script Also bind this option in sxhkd. --- .config/sxhkd/sxhkdrc | 10 +++++----- .local/bin/scripts/screenshot | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 3aa7d97..055e466 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -11,12 +11,12 @@ super + c super + s; {t,m,n,v} {tuirent,mails,rss,fm} -super + a; {g,k,l,i,k} - {gimp,keepassxc,libreoffice,inkscape,keepassxc} +super + a; {g,k,l,i} + {gimp,keepassxc,libreoffice,inkscape} super + m rofi-mpd -a -super + x +{Prior,super + x} slock super + z powermenu @@ -29,8 +29,8 @@ super + {_,shift +} e super + w choosewall -{_,shift +} Print - screenshot {_,--force} +{_,shift,ctrl +} Print + screenshot {_,--force,--force_area} {_,shift +} F1 {_,u}mounter {_,ctrl +} F10 diff --git a/.local/bin/scripts/screenshot b/.local/bin/scripts/screenshot index 651a14a..3933851 100755 --- a/.local/bin/scripts/screenshot +++ b/.local/bin/scripts/screenshot @@ -12,7 +12,13 @@ screenshot() { notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!" } -[ "$1" = "--force" ] && { screenshot && exit; } +clip() { + xclip -sel clip /dev/null; sleep 0.5 + xclip -selection clipboard -t image/png "$screen_path" +} + +[ "$1" = "--force" ] && { screenshot; exit; } +[ "$1" = "--force_area" ] && { type="-s -u" && screenshot && clip; exit ;} type="$(printf "ī„ˆ Screen\nī‡ž Area\n" | m 2 -p 'Screenshoter')" [ ! "$type" ] && exit @@ -26,6 +32,4 @@ time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')" sleep "$time" screenshot -[ "$save" = "ī€Œ Yes" ] && - xclip -sel clip /dev/null; sleep 0.5 - xclip -selection clipboard -t image/png "$screen_path" || exit +[ "$save" = "ī€Œ Yes" ] && clip || exit