Installing and Configuring tomate-gtk

I sometimes use tomate-gtk, an application that provides timers for the Pomodoro Technique, to ensure I take breaks when working AND that I continue to work afterwards. Yesterday, I decided to clean up my tomate-gtk installation.

I had it on my ToDo list for a long time to mute audio during pauses and enabling the screen lock after a pause ends broke with some version of tomate-gtk.

I had previously installed tomate-gtk as an AUR package on my Arch Linux system. The AUR package is still at version 0.18.1, while the newest version of tomate-gtk is 0.25.0. At some point the developer of tomate-gtk, who also maintained the AUR package, must no longer have thought it worth it to maintain it. I flagged the package as out-of-date yesterday; maybe they’ll fix it.

In the meantime, I build a package based on the newest release, using the official PKGBUILD. You can find the sources for this package in a repository on my private Git forge.

There were major changes since version 0.18.1. Previously plug-ins had their own repositories and had to be installed separately. Now, most plug-ins are part of the tomate-gtk sources and distributions. The exceptions seem to be the plug-ins that put an indicator in the panels of your window manager; I use tomate-statusicon-plugin for that.

Of the included plug-ins I use the Break Screen plug-in and the Script plug-in. The former makes the screen inaccessible during a break—though you can switch to another virtual terminal (e.g. with C-M-F2) and kill tomate-gtk to your screen, but then you are cheating yourself. The latter can be used to run scripts when a session–that is a work period, a short break, or a long break–starts, ends, or is manually stopped.

I created a script, ~/.bin/after_pause.sh, that mutes audio at the start of a pause, unmutes it at the end, and starts the screen lock at the end of a pause. The latter was previously provided as an option by the Break Screen plug-in, but that is no longer the case. There is also an Auto Pause plug-in that stops playback of any player whenever a session ends, but it is not sufficiently configurable, and it does not ever resume playback.

The contents of ~/.bin/after_pause.sh are

#!/usr/bin/env bash

# $1 is the session (POMODORO, SHORT_BREAK, LONG_BREAK)
# $2 is the event (SESSION_START, SESSION_END, SESSION_STOP)
#    (SESSION_STOP is manually stopping)

case $1 in
    SHORT_BREAK|LONG_BREAK)
        case $2 in
            SESSION_START)
                # Turn off sound (we cannot use the autopause plugin because it
                # triggers after any type of session and does not turn the
                # players back on)
                pactl set-sink-mute $(pactl get-default-sink) 1
                ;;
            SESSION_END|SESSION_STOP)
                # Turn on sound
                pactl set-sink-mute $(pactl get-default-sink) 0
                # Play alarm (we cannot use the alarm plugin because it triggers
                # before we unmute)
                mpv /usr/share/tomate/media/alarm.ogg &
                # Turn on screensaver
                slock
            ;;
        esac
        ;;
esac

and my configuration, ~/.config/tomate/tomate.conf has the following content:

[DEFAULT]
pomodoro_duration = 25
shortbreak_duration = 5
longbreak_duration = 15
long_break_interval = 4

[Plugin Management]
default_plugins_to_load = StatusIcon;;Break Screen;;Script

[script_plugin]
start_command = ~/.bin/after_pause.sh $session $event
stop_command = ~/.bin/after_pause.sh $session $event
finish_command = ~/.bin/after_pause.sh $session $event