dattanchu / pymodoro

Pymodoro is the Pomodoro for Xmobar or Dzen. It runs and it tells you where you are in your current pomodoro session.
MIT License
65 stars 18 forks source link

Transform script into a daemon #10

Open dominikmayer opened 13 years ago

dominikmayer commented 13 years ago

Would provide a way to communicate with the running script:

Session file would no longer be required but I would still keep it because of its obvious features:

Other way to implement both: Timestamp in a configuration file.

Daemon template: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/

dattanchu commented 13 years ago

Start, stop, restart, start with different times can already be done with the current version by setting the correct timestamp. Synchronization between several machines via Dropbox is already possible by letting Dropbox handle the session file.

Also, in which situation would we want pomodoro to keep running while script is down?

dominikmayer commented 13 years ago

Start/Stop

The only way to stop a pomodoro right now would be to delete the session file. I don't think it's a good idea to have a shortcut bound to "rm ~/.pymodoro/session_file".

Dropbox

I know. That's what I meant.

Pomodoros keep running while the script is down

I can close the script when the Pomodoro is down to 20 minutes, open it after five minutes and it will show fifteen remaining minutes. The time is not handled by the script itself. That's great.

Different times

I think the advantage of a daemon would be the possibiltiy to change its behaviour while it is running. Let's say I'm not doing Pomodoros (25 min.) for the moment but I'd like the script to count the time until my noodles (10 min.) are done. I could type something like "pymodoro.py 10" in any command line and it would switch the session duration of the running instance in the bar to ten minutes. Right now there is no way to do this without restarting Xmobar.

dattanchu commented 13 years ago

For stopping, you can set the session_file time to 25 minutes earlier. A simple way to accomplish this is to set the time with touch -r pomodoro.py session_file which should work most of the time (except within the first 25 minutes after which the user download the entire script).

For starting a different time, it is quite simple, simply add a command mode for pymodoro.py

pymodoro.py touch 10

This should set the session file so it has 10 minutes left. This method can also extend to handling Stopping a pomodoro session:

pymodoro.py touch -1

dominikmayer commented 13 years ago

You're right. I hadn't thought about that. I'm still not completely convinced, though. The progress bar would not reflect the change.

dominikmayer commented 13 years ago

I do agree that there are other ways than daemonizing (see also the suggestions in Issue #4) but don't you think a daemon would be comfortable?

dattanchu commented 13 years ago

I think daemonizing will eventually be realized. I don't feel that the complexity of the feature-set requires this yet.

dominikmayer commented 13 years ago

I added support for setting times in the session file (closes Issue #4).