Expand description
§pomodoro
This crate offers you a functional terminal based pomodoro clock.
§Dependencies
This application works on Linux and OSX, but not Windows (yet). On linux make sure that you have libdbus-1 installed - this is an essentialy dependency so that pomodoro can integrate with the linux notification system.
§Installation
This clock requires being built with nightly because of an experimental feature I used to keep the clock in sync and never fluctuating by more than 1ms. You can install the application with this command:
$ cargo +nightly install pomodoro
Note: On OSX you don’t need to install anything extra. Just use the above terminal command to install the binary crate with nightly
§Using pomodoro
To use, simply run it. By default it will give you a work time of 25 minutes, short break of 5 minutes and a long break of 20 minutes.
$ pomodoro
You can pass it terminal flags to customize the times. -w
flag will set the work time, -s
will set the short break time, and -l
will set the long break time. Here’s an example that
sets up a custom pomodoro with 30 minute work time, 10 minute short break and 25 minute long
break:
$ pomodoro -w 30 -s 10 -l 25
All of the controls for starting, quitting or resetting a pomodoro are displayed by the
pomodoro menu on launch. s
will start your next pomodoro. q
will take you back to the
menu if you are in a pomodoro, or quit if you are at the menu. r
will reset the current
pomodoro (back to the head of the work cycle and immediately begin countdown).
Commands are listened for in an asynchronous and non-blocking fashion.
Enjoy!
Structs§
- Clock
- A simple clock struct that displays minutes and seconds, and has methods for drawing a nice border around the current dispalyed time.
- Pomodoro
Config - You can use this terminal program to start a pomodoro timer.
- Pomodoro
Session - This struct represents a pomodoro session - which is from the start of running the application until you terminate it. Between that time this struct will keep track of the initial height and width of the terminal window when launching pomodoro, and keep a lock on stdin and stdout so we can draw to the screen, and also accept async input from the user. Lastly, this session also holds a state tracker, the clock itself (that gets drawn) and a config file. The config is passed in by the user. -w flag will pass in a custom work time, -s will pass in a custom short break time, and -l will pass in a custom long break time.
- State
Tracker - A simple state tracker that keeps track of the pomodoro state, the current order we are in (1 to 4 or None if we haven’t begun our first pomodoro yet), and when the current pomodoro was started at. (Started at is None between pomodoros).
Enums§
- Command
- Simple struct to translate user keystrokes into command types we can enforce with matches.
Constants§
- CONTROLS
- Controls layout always on screen when clock is rolling.
- POMODORO_
START_ PROMPT - Initial pomodoro welcome menu.
Functions§
- run
- Basic run function that is called from the binary. Takes the current terminal size, and config from terminal flags and passes that into our init function