-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlock-timer.sh
More file actions
executable file
·44 lines (35 loc) · 908 Bytes
/
lock-timer.sh
File metadata and controls
executable file
·44 lines (35 loc) · 908 Bytes
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
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "No timer command supplied. Exiting..."
exit
fi
dir="$(dirname "$0")"
pkill xidlehook
if [ -e /tmp/xidlehook.sock ]; then
rm /tmp/xidlehook.sock
fi
export PRIMARY_DISPLAY="$(xrandr | grep primary | cut -d ' ' -f 1)"
read -r -d '' lock << EOF
# Pause notifications
pkill dunst -USR1
$1
# Start notifications
pkill dunst -USR2
EOF
export lock
# --not-when-audio \
xidlehook \
--not-when-fullscreen \
--socket /tmp/xidlehook.sock \
--timer 600 \
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
--timer 10 \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1 && /bin/sh -c "$lock"' \
'' \
--timer 60 \
'xset dpms force off' \
'' \
--timer 600 \
'systemctl suspend' \
'' \