blob: f606250e049c09fce8a3fb1d40eec456140b325f (
plain)
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
|
#!/bin/bash
set -e
set -u
FLAGFILE="$HOME/.screensaver-pause.flag"
usage() {
echo "$0 [<minutes>]"
}
while getopts "h" OPTION; do
case "$OPTION" in
h)
usage
exit 0
;;
*)
usage >&2
exit 1
esac
done
shift $(($OPTIND - 1))
if [ "$#" -gt 1 ]; then
usage >&2
exit 1
elif [ "$#" -eq 1 ]; then
timeout="$1"
else
timeout=60
fi
touch -d "+$timeout minutes" "$FLAGFILE"
(
while find "$FLAGFILE" -mmin -0 2>/dev/null | grep -q .; do
qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity >/dev/null
sleep 30
done
rm -f "$FLAGFILE"
) &
disown
|