jbirnick / polybar-timer

A simple & customizable timer for your bar.
MIT License
62 stars 6 forks source link

Adding a play/pause functionnality #4

Closed Samickey closed 2 years ago

Samickey commented 2 years ago

I use your script to time some particular tasks, and I can get often interrupted… Hence, I found it interesting to add a pause functionality to the timer. I bound it to click-left in polybar and bound only one new timer creation on click-right.

I implemented the command polybar-timer.sh pause. First time it's called, it stops the running timer by creating a paused file with the remaining seconds until expiry and removes the expiry file. When it's called again on a paused timer, it recreates the expiry file from the paused file. If there's no running timer, it exits with return code 1. This functionality should not change anything to the prior behavior of the timer. I tried to make the minimum possible changes to already existing code and follow the spirit of the code already written. I'm obviously open to comments on my modifications and suggestions to improve them.

I just added a simple description to the documentation for the pause command. I could add a configuration example for the pause functionality, but it would imply heavier modification to the documentation. Maybe for a next commit if you are interested.

Cheers,

jbirnick commented 2 years ago

Thanks! I edited the code a bit and merged it to the master branch. :)

Samickey commented 2 years ago

Nice ! And thank you for all the work ! :+1: