I like to set timers for myself when I’m working, because I find it helps me keep focussed on a task. Here is my simple timer implementation.

Requirements

  • tmux
  • at
  • A window named timer in your tmux session.

tmux.conf setup

In your tmux.conf, make sure you have something similar to this:

setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1

Timer script

Put the following timer script in your $PATH. I call it alert.sh:

#!/bin/bash
tmux send-keys -t "timer" 'echo "\a"' Enter

Add function to your profile

function timer()
{
        at -f ~/projects/alert/alert.sh now + "$1" minute
}

Run a timer

% timer 5
job 21 at Mon Nov  7 18:37:00 2016

List outstanding timers

% atq
21      Mon Nov  7 18:37:00 2016 a service

Be alerted when the timer is up

Now you can go about your work, and when the timer is up, the tmux window will be highlighted in the status bar. Timer