mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-27 20:18:49 +02:00
xss-lock: use a dimmer service to start/stop dimmer
This way, we can lock the screen before stopping dimmer.
This commit is contained in:
parent
8d70ce8106
commit
3d9c3e458c
2 changed files with 12 additions and 3 deletions
10
bin/xss-lock
10
bin/xss-lock
|
@ -12,6 +12,9 @@ unconfigure() {
|
||||||
xset s 0
|
xset s 0
|
||||||
xset dpms 0 0 0
|
xset dpms 0 0 0
|
||||||
}
|
}
|
||||||
|
dimmer() {
|
||||||
|
systemctl --user $1 dimmer@$notify.service
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
@ -20,9 +23,10 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
dim|notify)
|
dim|notify)
|
||||||
echo "notify: start (idle: $(xprintidle))"
|
echo "notify: start (idle: $(xprintidle))"
|
||||||
trap 'echo notify: user activity; kill %% 2> /dev/null; exit 0' HUP # user activity
|
trap 'echo notify: user activity; dimmer stop; kill %% 2> /dev/null; exit 0' HUP # user activity
|
||||||
trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started
|
trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started
|
||||||
~/.config/i3/bin/dimmer --delay $notify &
|
dimmer start
|
||||||
|
sleep infinity &
|
||||||
wait
|
wait
|
||||||
echo "notify: end"
|
echo "notify: end"
|
||||||
;;
|
;;
|
||||||
|
@ -36,7 +40,7 @@ case "$1" in
|
||||||
# Then, lock screen
|
# Then, lock screen
|
||||||
i3lock -n -e -i $HOME/.cache/i3/current-wallpaper.png -t -f
|
i3lock -n -e -i $HOME/.cache/i3/current-wallpaper.png -t -f
|
||||||
echo "lock: unlock screen"
|
echo "lock: unlock screen"
|
||||||
# Resume notifications
|
dimmer stop
|
||||||
dunstctl set-paused false
|
dunstctl set-paused false
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
5
dotfiles/systemd/dimmer@.service
Normal file
5
dotfiles/systemd/dimmer@.service
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Screen dimmer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=%h/.config/i3/bin/dimmer --delay=%i
|
Loading…
Add table
Add a link
Reference in a new issue