open-pomodoro / openpomodoro-cli

A command-line Pomodoro tracker which uses the Open Pomodoro Format
MIT License
336 stars 25 forks source link

A few thoughts #14

Closed sweenu closed 3 years ago

sweenu commented 3 years ago

I've discovered this project after comparing dozens of pomodoro projects (cli and graphical) and I really like it. I think it's simple yet very flexible. There are just a few things that I think could be improved:

justincampbell commented 3 years ago

@Sweenu Thanks for checking it out and leaving such thoughtful feedback!

The break command is not very useful as it is blocking, and you cannot fetch the status of the break with pomodoro status. Therefore, I cannot use the break command in my waybar module easily. I think I'm just going to do pomodoro start -d 5 break that way I can have the status.

This is interesting! I usually run pomodoro break and then walk away from my computer, and I can glance at it to see if my break is up yet. I had not considered viewing the break in the status output/my tmux status. Perhaps we could store the break in its own file. I don't think it should go in history, because that would require filtering out breaks to determine pomodoro counts. It could perhaps go in current with a break boolean.

The current file is of the format duration= which is not the most practical for parsing as you need to get rid of duration= in your code. I think a csv like format is better suited or even just a space to separate both fields, like . I also think using seconds instead of minutes would give more flexibility and is also easier to work with as it is usually the default unit in tools dealing with durations (for example sleep from coreutils).

The format for current matches history entries. Both can support more than just start and duration, such as description and tags. If you split the line on the first whitespace, the left half is a valid timestamp, and the right half is in logfmt. The logfmt may also be readable by a standard key=value config parser, I haven't tried.

Regarding minutes vs seconds, my goal was to make the file human editable, and I find it much simpler to read and edit duration=25 than duration=1500. The lack of precision has not bothered me for this use case. It does however require an extra conversion step into seconds when parsing it.

Lastly, one of the important thing in a pomodoro program is to be able to be notified when your session is finished. I really like the hook system because I think it fits well in the unix philosophy, it lets me use whichever notification system I prefer, but there is no hook available for when a session is finished, which is the most important hook. I know it is not as easy as the other hooks because it would require a daemon that watches the current file regularly, but it is so important that I think it should be included in this program, written in go, rather than letting the user make a daemon himself with the start hook.

I agree! This is the biggest improvement that could be made in my opinion. I haven't decided on how it should work though. Would you want a pomodoro daemon or pomodoro service command that you could run manually? Should running any pomodoro command launch a process and store a pid in ~/.pomodoro? Most importantly, does that background process have the capability to play a sound or notify the terminal bell.

For my use case, I'd want a GUI (macOS menubar app) that shows the current Pomodoro status, and covers the screen when a Pomodoro is finished. I currently use Tadam in conjunction with the CLI to get a status in both screen states. The intent of separating the storage format (github.com/open-pomodoro/open-pomodoro-format) from the CLI was so that other apps could read and write the same data simultaneously, or allow the user to switch between different apps. I'm experimenting with making a menubar app in Go with github.com/getlantern/systray that uses the same openpomodoro package, but I don't have anything to show yet.

sweenu commented 3 years ago

This is interesting! I usually run pomodoro break and then walk away from my computer, and I can glance at it to see if my break is up yet. I had not considered viewing the break in the status output/my tmux status. Perhaps we could store the break in its own file. I don't think it should go in history, because that would require filtering out breaks to determine pomodoro counts. It could perhaps go in current with a break boolean.

You might want to be notified with a sound or a notification about the break being finished that's why it should allow the same flexibility (of being pollable with pomodoro status) as a normal session IMO. You will never be both in a break and in a normal session, so another file seems too much, the boolean seems more appropriate.

I get your point about the current file format and using minutes instead of seconds, it makes sense 👍🏽

I think it's one of this project's strength to be super simple and just create a file when you do pomodoro start instead of a whole daemon. So I think keeping that the default would be the best. My favorite solution is to have a --enable-finish-hook flag (or some better name) to the start command which will, in this case, create a daemon that will poll the file every second and trigger a hook when the session is done. That way, the user still has the flexibility of choosing his own way to notify himself. The hook system is great, let's use it.

Currently, the solution I found, was to have this in ~/.pomodoro/hooks/start:

current_file=~/.pomodoro/current
args=$(cut -d' ' -f2- $current_file)
eval $args
echo "sleep ${duration}m && [ -s $current_file ] && notify-send '🍅 Pomodoro' 'Session finished'" | at now

I'm sure this could be improved, but it might give an idea of what we could implement.

I'm experimenting with making a menubar app in Go with github.com/getlantern/systray that uses the same openpomodoro package, but I don't have anything to show yet.

Awesome! I would gladly help out, I was thinking of starting something like that myself.

towith commented 3 years ago

Great, the only one pomodoro cli app has windows version I have found.

justincampbell commented 3 years ago

Going to close this as there's nothing to be done at the moment. Thanks for the questions and feedback! Someday we'll get around to adding a great daemon/notification system.