jD91mZM2 / xidlehook

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

howto: Run timer unaffected by X11 activity? #30

Closed skewballfox closed 4 years ago

skewballfox commented 5 years ago

Is it possible to use xidle to run a timer that isn't affected by whether X is idle or not?

Like a pomodoro timer that runs the screen locker after 25 minutes of the screen being unlocked? this would be a separate timer from the one that is running after 5 minutes of inactivity.

jD91mZM2 commented 5 years ago

I'm not sure I understand, you want it to run the screen locker 25 minutes of the screen being unlocked, regardless of activity?

skewballfox commented 5 years ago

Yeah, with a primary timer based on inactivity that locks after 5 minutes resetting both timers, or vice versa. It's basically a way to enforce the pomodoro technique so I don't spend 6 hours sitting at my computer and forgetting to do things like eat.

jD91mZM2 commented 5 years ago

Ah, so you want to lock every 25 minutes, unless you leave your computer for 5 minutes which will also lock?

So, correct me if I'm wrong, a day for you could look like:

Then I'd recommend using a bash script for that 25 minute timer, something like

while true; do
    sleep 25m
    xidlehook-client --trigger --socket <path>
    <wait until some ipc message sent by your lock script after unlock>
done
skewballfox commented 5 years ago

thanks, I'll get this implemented

jD91mZM2 commented 5 years ago

I am currently experimenting with a library-based xidlehook which would allow you to make your own module that does what you want.

jD91mZM2 commented 4 years ago

xidlehook has been rewritten to be a library (see !6). This lets you register any kind of timer using traits. Feel free to PR something that adds such a module if you deem it useful to the majority of xidlehook users. You can also extend xidlehook yourself using the awesome library system, essentially wrapping it with a more fine-tuned configuration using rust code.