jD91mZM2 / xidlehook

GitLab: https://gitlab.com/jD91mZM2/xidlehook
MIT License
387 stars 33 forks source link

howto: detect ac power to disable #15

Closed senorsmile closed 5 years ago

senorsmile commented 5 years ago

Would it be possible using the existing version of xidlehook to detect when on AC power to disable one of the "stages" (i.e. still start screensaver but do not suspend)?

jD91mZM2 commented 5 years ago

Why not just check it with dash as one of the timers? Such as:

--timer normal "on_ac_power && systemctl suspend" ""
senorsmile commented 5 years ago

Perfect! Didn't know on_ac_power was even a thing.

jpmorris commented 5 years ago

For those on arch: grep 0 /sys/class/power_supply/AC/online > /dev/null && systemctl suspend