Hooks configuration

Hooks allow you to execute actions during the server and the timer lifecycles. There is 2 possible type of actions:

  • Execute a shell command (requires the hook-command cargo feature).
  • Send a system notification (requires the hook-notify cargo feature).

A hook follows the pattern on-{target}-{event}, where the target is either server, timer or the kebab-case version of the current cycle’s name.

on-{target}-{event}.cmd

Execute the given shell command when the given event is emitted.

[presets.example]
hooks.on-timer-start.cmd = "task start"

on-{target}-{event}.notify

Send the given system notification when the given event is emitted.

[presets.example]
hooks.on-timer-start.notify.summary = "Comodoro"
hooks.on-timer-start.notify.body = "Timer started!"

Server hooks

  • on-server-start, when the server starts

  • on-server-stopping, when the server received the order to stop

  • on-server-stop, when the server stops

Timer hooks

  • on-timer-start, when the timer starts

  • on-timer-stop, when the timer stops

You also have access to cycle-specific hooks, where {name} is the kebab-case version of your custom cycle’s name:

  • on-{name}-begin, when the cycle begins

  • on-{name}-running, when cycle runs (tick)

  • on-{name}-set, when the cycle duration is manually changed

  • on-{name}-pause, when the cycle is paused

  • on-{name}-resume, when the cycle is resumed

  • on-{name}-end, when the cycle ends