swaywm / swaylock

Screen locker for Wayland
MIT License
850 stars 200 forks source link

[FR] Support for unlock timeout for RSI/OOS #362

Closed jamesawebb closed 5 months ago

jamesawebb commented 5 months ago

Currently there aren't great RSI/OOS tools for sway. Adding support to unlock after a defined period would be an easy way to provide RSI/OOS capabilities.

emersion commented 5 months ago

It should be possible to script this. Start swaylock in the background, send SIGUSR1 to swaylock after the timeout.

Note, I am not familiar with RSI/OOS.

jamesawebb commented 5 months ago

It should be possible to script this. Start swaylock in the background, send SIGUSR1 to swaylock after the timeout.

Indeed. Covered well at https://github.com/swaywm/sway/issues/7665. I should be able to script this.

Note, I am not familiar with RSI/OOS.

You're lucky. It's not pleasant. https://rsi.org.au/index.php/what-is-rsi-and-oos/

jamesawebb commented 4 months ago

For anyone interested in doing the same (this comes well recommended), I currently have the following crontab entry:

# OOS break: pause every 12m for 10s
*/12 * * * * [ $(pgrep -c swaylock) = 0 ] && ( XDG_RUNTIME_DIR=/run/user/$(id -u) WAYLAND_DISPLAY=wayland-1 /usr/local/bin/swaylock --font break && sleep 10 && pkill -f -USR1 "swaylock --font break" )

I'm sure improvements can be made, but this suits my needs reasonably well.