All Projects → hughbien → Thyme

hughbien / Thyme

Licence: bsd-3-clause
Pomodoro timer for tmux

Programming Languages

crystal
512 projects

Thyme

Thyme is a pomodoro timer for tmux.

Thyme Example

Installation

Mac

brew install hughbien/tap/thyme

This will install Crystal v0.36.1 as a dependency. If you already have this version of Crystal, feel free to run:

brew install hughbien/tap/thyme --ignore-dependencies crystal

Linux

Download the latest binary and place it in your $PATH:

wget -O thyme https://github.com/hughbien/thyme/releases/download/v0.1.3/thyme-linux64-0.1.3

Checksums are:

  • sha256: 886e9a7ed4af214ca350fea7bd0685668c190ffbe4028cecc6fef6cffe681769
  • md5: d62beffe9666a9df77a8e3fc2343c8d8

From Source

Checkout this repo, run make and make install:

git clone https://github.com/hughbien/thyme.git
cd thyme
make
make install

Usage

Start thyme with:

thyme

You'll have 25 minutes by default. Other useful commands:

thyme       # run again to pause/unpause
thyme -s    # to stop
thyme -r    # repeats timer until manually stopped; default break of 5 minutes
thyme -r10  # repeat timer 10 times
thyme -f    # run in foreground, useful for debugging hooks

Configuration

Configure via the ~/.thymerc file:

timer: 1500               # 25 minutes per pomodoro (in seconds)
timer_break: 300          # 5 minutes per break (in seconds)
timer_warning: 300        # show warning color at 5 minutes left (in seconds)
repeat: 4                 # set default for -r flag, otherwise repeat indefinitely
color_default: "default"  # set default timer color for tmux
color_warning: "red"      # set warning color for tmux, set to "default" to disable
color_break: "default"    # set break color for tmux
status_align: "left"      # use tmux's left status line instead, defaults to "right"

Thyme sets tmux's status-right/left and interval for you. If you'd prefer to do this yourself (or need to combine it with other statuses), set status_override:

status_override: false    # don't let thyme set tmux's status-right/left/interval

Then in your ~/.tmux.conf file, set the status command and interval:

set -g status-right '#(cat /path/to/thyme-status)'
set -g status-interval 1

Custom options can be added via the options group. The today example below adds a -t option for opening a todo today file. The hello example echos to STDOUT.

options:
  today:
    flag: "-t"
    flag_long: "--today"
    description: "Open TODO today file"
    command: "vim ~/path/to/todo.md"

  hello:
    flag: "-H"
    flag_long: "--hello name"
    description: "Say hello!"
    command: "echo \"Hello #{flag}! #{args}.\"" # eg `thyme -H John "How are you?"`

The following placeholders are available for options:

  • #{flag} - the argument passed to your flag
  • #{args} - any additional arguments passed to the thyme binary

Custom hooks can be added via the hooks group. Valid events are: before/after a pomodoro, before_break/after_break for breaks, and before_all/after_all for the entire session.

hooks:
  notify:
    events: ["after"]
    command: "terminal-notifier -message \"Pomodoro finished #{repeat_suffix}\" -title \"thyme\""

  notify_break:
    events: ["after_break"]
    command: "terminal-notifier -message \"Break finished #{repeat_suffix}\" -title \"thyme\""

The following placeholders are available for hooks:

  • #{repeat_index} - current repeat index
  • #{repeat_total} - total repeat count for this session
  • #{repeat_suffix} - if repeating is on, will return (index/total) eg (3/5). Otherwise empty string.

Development

Use make for common tasks:

make build                   # to create a release binary in the bin directory
make build-static            # to create a static release binary for Linux
make install                 # to copy release binary into system bin (uses $INSTALL_BIN)
make spec                    # to run all tests
make spec ARGS=path/to/spec  # to run a single test
make clean                   # to remove build artifacts and bin directory
make reset                   # to reload ~/.tmux.conf file (useful while debugging)
make run                     # to run locally
make run ARGS=-h             # to run with local arguments

TODO

  • handle laptop closed for long pause

License

Copyright 2021 Hugh Bien.

Released under BSD License, see LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].