-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscreensaver
executable file
·59 lines (53 loc) · 1.25 KB
/
screensaver
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
51
52
53
54
55
56
57
58
59
#!/bin/bash
xset s 300 5
have_command() {
test -x "$(command -v "$1")"
}
maybe_xfce4_screensaver() {
local init_command="xfce4-screensaver"
local lock_command="xfce4-screensaver-command"
have_command "$init_command" || return 1
have_command "$lock_command" || return 1
case $1 in
init)
(setsid "$init_command"&)
# TODO: is this needed?
(xss-lock -l -- "$lock_command" --lock&)
;;
lock)
exec "$lock_command" --lock
;;
esac
}
maybe_xsecurelock() {
local init_command="xsecurelock"
local lock_command="xsecurelock"
have_command "$init_command" || return 1
if test -f "$HOME/.xsecurelockrc"; then
. "$HOME/.xsecurelockrc"
fi
case $1 in
init)
(xss-lock -l -- "$init_command"&)
;;
lock)
exec "$lock_command"
;;
esac
}
maybe_xscreensaver() {
local init_command="xscreensaver"
local lock_command="xscreensaver-command"
have_command "$init_command" || return 1
have_command "$lock_command" || return 1
case $1 in
init)
(setsid "$init_command"&)
(xss-lock -- "$lock_command" --lock&)
;;
lock)
exec "$lock_command" --lock
;;
esac
}
maybe_xsecurelock "$@" || maybe_xscreensaver "$@" || maybe_xfce4_screensaver "$@" || exit 1