jD91mZM2/xidlehook

howto: Run timer unaffected by X11 activity?

Closed this issue · 6 comments

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.

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

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.

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:

  • 25 minutes work, then lock
  • take a 3 minute break
  • 25 minutes work, then lock
  • take a 3 minute break
  • 7 minutes work, then you go take a coffee
  • 5 minutes inactivity, then lock
  • you unlock and continue work
  • 25 minutes work, then lock
  • ... and over

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

thanks, I'll get this implemented

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

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.