Crates.io | zentime-rs |
lib.rs | zentime-rs |
version | 0.15.0 |
source | src |
created_at | 2022-11-08 20:29:04.573916 |
updated_at | 2023-05-05 13:42:28.214591 |
description | Pomodoro and productivity timer written in Rust |
homepage | |
repository | https://github.com/on3iro/zentime-rs |
max_upload_size | |
id | 708274 |
size | 826,043 |
A simple terminal based pomodoro/productivity timer written in Rust.
NOTE: The timer has currently only been tested on Mac and Linux, but might also work on Windows (please let me know if you tried it succesfully).
brew tap on3iro/zentime
brew install zentime
cargo install zentime-rs
Coming soon
The default location for the configuration file is /home/<user>/.config/zentime/zentime.toml
.
To get an overview of available configuration options please have a look at the example configuration.
For an overview of all available configuration keys, check out the docs.
Note that each key (view
, timers
etc.) corresponds to the header of a toml table while
clicking on the type inside the docs shows you the available configuration fields.
Logs are being written to:
/tmp/zentime.d.err
- this captures any panics/tmp/zentime.d.out
- this captures error/warn/info etc. logsThe default log level is warn
.
You can configure the log level by running zentime with RUST_LOG=<level> zentime
.
Here's an overview of available log levels.
I've found that currently the easiest way to get some integration with zentime into zellij, is to create a custom layout and also create some shell aliases.
For example you could use the following layout as base for a 'zellij-zentime'-layout:
layout {
pane split_direction="vertical" size=1 {
pane {
size 30
borderless true
name "zentime"
command "zentime"
}
pane borderless=true {
plugin location="zellij:tab-bar"
}
}
}
You might need to adjust the size of the zentime pane depending on the terminal font you are using.
WARNING: There currently is no way to isolate regular panes in zellij from the tab-sync mechanism. (Only plugin panes are currently isolated) This means that you might accidentally change your timer, when you use tab-sync mode. I already created a feature request to create isolated panes and am planning to contribute and create a PR if the maintainer is fine with that.
NOTE: I actually wanted to write a plugin for zellij. However unfortunately this is currently not that easy for two reasons:
- The zellij plugin system is currently being rebuilt and it doesn't really make sense to built a "legacy"-plugin right now
- Our zentime client library code makes use of a lot of async code, which does not yet compile to WASI
Because zellij also does not yet allow arbitary commands to be configured with keyboard shortcuts, you basically have three options to interact with zentime:
zentime skip
, zentime toggle-timer
etc.If you go the third route I would recommend to prefix each command with -s
(--silent
) as you probably are not interested in the minor output zentime gives you under these circumstances.
To display the current timer state inside the tmux status bar you could use zentime once
which will be queried by tmux on each status bar update.
Simply add the following snippet to your .tmux.conf
:
set -g status-left " #(zentime once) "
If you would like to add shortcuts (e.g. to toggle pause/play) from inside tmux you could add bindings like this:
bind t run-shell "zentime toggle-timer > /dev/null"
bind y run-shell "zentime skip > /dev/null"
Zentime is built in such a way, that it should be possible to build custom clients etc. to attach to the server. To do so one should use the modules provided by the library crate. More documentation/examples on how to use these, will follow soon.
NOTE: The API of the library crate is not yet stable and might change on minor version updates. As soon as this crate reaches 1.0.0 status, breaking changes will only ever happen on major versions.