Add --force_area option to screenshot script

Also bind this option in sxhkd.
This commit is contained in:
Wiktor Zykubek 2020-06-01 08:26:03 +02:00
parent b9e5ed6e27
commit bb20ed4d7c
2 changed files with 13 additions and 9 deletions

View File

@ -11,12 +11,12 @@ super + c
super + s; {t,m,n,v} super + s; {t,m,n,v}
{tuirent,mails,rss,fm} {tuirent,mails,rss,fm}
super + a; {g,k,l,i,k} super + a; {g,k,l,i}
{gimp,keepassxc,libreoffice,inkscape,keepassxc} {gimp,keepassxc,libreoffice,inkscape}
super + m super + m
rofi-mpd -a rofi-mpd -a
super + x {Prior,super + x}
slock slock
super + z super + z
powermenu powermenu
@ -29,8 +29,8 @@ super + {_,shift +} e
super + w super + w
choosewall choosewall
{_,shift +} Print {_,shift,ctrl +} Print
screenshot {_,--force} screenshot {_,--force,--force_area}
{_,shift +} F1 {_,shift +} F1
{_,u}mounter {_,u}mounter
{_,ctrl +} F10 {_,ctrl +} F10

View File

@ -12,7 +12,13 @@ screenshot() {
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!" 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="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')"
[ ! "$type" ] && exit [ ! "$type" ] && exit
@ -26,6 +32,4 @@ time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')"
sleep "$time" sleep "$time"
screenshot screenshot
[ "$save" = " Yes" ] && [ "$save" = " Yes" ] && clip || exit
xclip -sel clip /dev/null; sleep 0.5
xclip -selection clipboard -t image/png "$screen_path" || exit