services: Add swayidle processing as service
swayidle is now also presented as a user service managed by runit on voidlinux. It comes with the same defaults as before (300 seconds to lockscreen, 600 seconds to screen dimming and 900 seconds before suspending). Additionally the lockscreen script has been updated to correctly tell a wayland from a non-wayland session without logind being available on the system, though it still defaults to using loginctl if it finds it. The service runs as swayidle in the user services directory and can be confirured using a 'conf' file which would be placed in the 'swayidle' service directory. Timeouts can be set with `time_to_lockscreen`, `time_to_screendim` and `time_to_suspend`.
This commit is contained in:
parent
b0ab5c59dd
commit
c00cbdbade
4 changed files with 33 additions and 11 deletions
3
services/sv/swayidle/log/run
Executable file
3
services/sv/swayidle/log/run
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
exec vlogger -t swayidle -p daemon
|
||||
20
services/sv/swayidle/run
Executable file
20
services/sv/swayidle/run
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
time_to_lockscreen="${time_to_lockscreen:-300}"
|
||||
time_to_screendim="${time_to_screendim:-600}"
|
||||
time_to_suspend="${time_to_suspend:-900}"
|
||||
|
||||
[ -r ./conf ] && . ./conf
|
||||
|
||||
exec 2>&1
|
||||
|
||||
# usual setup:
|
||||
# waylock -init-color 0x223344 -input-color 0x224444 -fail-color 0x554444 -fork-on-lock
|
||||
|
||||
exec chpst -e "$TURNSTILE_ENV_DIR" swayidle \
|
||||
timeout "${time_to_suspend}" "[ $(cat /sys/class/power_supply/AC/online) -eq 0 ] && sudo zzz" \
|
||||
timeout "${time_to_screendim}" "wlopm --off '*'" \
|
||||
resume "wlopm --on '*'" \
|
||||
timeout "${time_to_lockscreen}" "pidof waylock || lockscreen" \
|
||||
after-resume "wlopm --on '*'" \
|
||||
before-sleep "pidof waylock || lockscreen"
|
||||
Loading…
Add table
Add a link
Reference in a new issue