-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrofi-screenshot
executable file
·50 lines (40 loc) · 1.85 KB
/
rofi-screenshot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# __ _ _
# _ __ ___ / _(_) _ __ ___ __ _(_)_ __ ___
# | '__/ _ \| |_| | | '_ ` _ \ / _` | | '_ ` _ \
# | | | (_) | _| | | | | | | | (_| | | | | | | |
# |_| \___/|_| |_| |_| |_| |_|\__,_|_|_| |_| |_|
# Author: Dilip Chauhan
# Github: https://github/TechnicalDC
# This script requires grim and slurp
DIR="$HOME/Pictures/screenshots/"
NAME="grim_$(date +%d%m%Y_%H%M%S).png"
USE_ICON="no"
ROFI_THEME=$HOME/.config/rofi/themes/pywal/screenshot.rasi
option1=" Entire screen"
option2=" Entire screen with delay"
option3=" Selection"
option4=" Active window"
delayoption1="Take screenshot with 3 sec delay"
delayoption2="Take screenshot with 5 sec delay"
delayoption3="Take screenshot with 10 sec delay"
options="$option1\n$option2\n$option3"
choice=$(echo -e "$options" | rofi -theme $ROFI_THEME -i -dmenu -no-show-icons -no-sidebar-mode -p " Screenshot " -mesg "DIR: $DIR")
case $choice in
$option1)
sleep 1
grim $DIR$NAME && notify-send 'Grim' 'Screenshot saved.' -i $DIR$NAME -t 2000 ;;
$option2)
delayoptions="$delayoption1\n$delayoption2\n$delayoption3"
delay=$(echo -e "$delayoptions" | rofi -theme $ROFI_THEME -i -dmenu -no-show-icons -no-sidebar-mode -lines 3 -width 30 -p " Screenshot " -mesg "DIR: $DIR")
case $delay in
$delayoption1)
sleep 3; grim $DIR$NAME && notify-send 'Grim' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
$delayoption2)
sleep 5; grim $DIR$NAME && notify-send 'Grim' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
$delayoption3)
sleep 10; grim $DIR$NAME && notify-send 'Grim' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
esac ;;
$option3)
grim -g "$(slurp)" $DIR$NAME && notify-send 'Grim' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
esac