Add emojis to screenshot script and '--force' arg

This commit is contained in:
Wiktor Zykubek 2020-05-11 20:23:12 +02:00
parent e3f6081939
commit 96ea6d82bf
2 changed files with 23 additions and 15 deletions

View File

@ -29,6 +29,8 @@ super + g
#~~~~~~~~~
Print
screenshot
shift + Print
screenshot --force
super + m
rofi-mpd -a
super + x
@ -36,7 +38,7 @@ super + x
super + z
powermenu
super + u
updater
update
super + n
rofi-todo -f $HOME/doc/notes/notes.json
super + e

View File

@ -1,23 +1,29 @@
#!/usr/bin/env sh
m() { rofi -dmenu -i -l "$@"; }
type="$(printf "Screen\nArea\n" | m 2 -p 'What do you want to screenshot?')"
[ ! "$type" ] && exit
save="$(printf "No\nYes" | m 2 -p 'Do you want to copy to clipboard?')"
[ ! "$save" ] && exit
time="$(printf "0.7\n5\n10\n15" | m 3 -p 'How many seconds you want to wait?')"
[ ! "$time" ] && exit
[ "$type" = "Area" ] && type="-s -u" || type=""
m() { rofi -dmenu -width 200 -i -l "$@"; }
mkdir -p ~/pix/Screenshots
sleep "$time"
screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png
maim $type "$screen_path" &&
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!"
screenshot() {
maim $type "$screen_path" &&
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!"
}
[ "$save" = "Yes" ] &&
[ "$1" = "--force" ] && { screenshot && exit; }
type="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')"
[ ! "$type" ] && exit
save="$(printf " No\n Yes" | m 2 -p 'Copy?')"
[ ! "$save" ] && exit
time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')"
[ ! "$time" ] && exit
[ "$type" = " Area" ] && type="-s -u" || type=""
sleep "$time"
screenshot
[ "$save" = " Yes" ] &&
xclip -sel clip /dev/null; sleep 0.5
xclip -selection clipboard -t image/png "$screen_path" || exit