feat: switch to xidlehook
This commit is contained in:
parent
00cef52dcf
commit
d96a5583ad
2 changed files with 24 additions and 2 deletions
22
dot_config/i3/scripts/autolock.sh
Normal file
22
dot_config/i3/scripts/autolock.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/sh
|
||||
# Only exported variables can be used within the timer's command.
|
||||
export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')"
|
||||
|
||||
# Run xidlehook
|
||||
xidlehook \
|
||||
`# Don't lock when there's a fullscreen application` \
|
||||
--not-when-fullscreen \
|
||||
`# Don't lock when there's audio playing` \
|
||||
--not-when-audio \
|
||||
`# Dim the screen after 1 minute and 20 seconds, undim if user becomes active` \
|
||||
--timer 80 \
|
||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
|
||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
|
||||
`# Undim & lock after 10 more seconds` \
|
||||
--timer 10 \
|
||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; i3lock' \
|
||||
'' \
|
||||
`# Finally, suspend an hour after it locks` \
|
||||
--timer 3600 \
|
||||
'systemctl suspend' \
|
||||
''
|
Loading…
Add table
Add a link
Reference in a new issue