-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
41 lines (35 loc) · 1.07 KB
/
.bash_profile
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
function trigger-on-screen-lock-state-change() {
nohup gdbus monitor -y -d org.freedesktop.login1 |
grep --line-buffered "org\.freedesktop\.DBus\.Properties\.PropertiesChanged.*'org\.freedesktop\.login1\.Session'.*'LockedHint'" |
tee /dev/tty |
sed -E "s/^.*\{'LockedHint': <(true|false)>\}.*$/\1/" |
while read state
do
case "${state}" in
true)
on-screen-lock
;;
false)
if xrandr --listactivemonitors | grep -E '^ *[0-9]+' | cut -d ' ' -f 6 | grep -q HDMI-1
then
~/.screenlayout/home.sh # generated with arandr
fi
;;
esac
done 2>&1 | tee ~/tmp/trigger-on-screen-lock-state-change.out &
}
function on-screen-lock() {
true
}
function on-screen-unlock() {
set-resolution
}
function set-resolution() {
if xrandr --listactivemonitors | grep -E '^ *[0-9]+' | cut -d ' ' -f 6 | grep -q HDMI-1
then
~/.screenlayout/home.sh # generated with arandr
fi
}
trigger-on-screen-lock-state-change
gnome-terminal -- "${HOME}/bin/ovpn"
. ~/.bashrc