Skip to content

Notifications

Ö. Efe D. edited this page Sep 15, 2026 · 1 revision

Notifications

Programs can show desktop notifications through tron with three escape sequences:

Sequence Origin
OSC 9 ; body ST iTerm2 and ConEmu
OSC 777 ; notify ; title ; body ST urxvt, used by many tools
OSC 99 ; ... ST kitty's notification protocol

Try it

printf '\e]777;notify;Build;finished\e\\'
printf '\e]9;Tests passed\e\\'

By default a notification shows only while the tron window has no focus.

Settings

[notifications]
# never, unfocused (only while the window has no focus) or always.
mode = "unfocused"
# Run as: command --app-name tron -- title body.
# Default: notify-send, or osascript on macOS.
command = "notify-send"

On Linux, tron runs notify-send, from libnotify (Fedora) or libnotify-bin (Debian and Ubuntu). On macOS it shows the notification through osascript.

Notify when a long command finishes

With a notification after long commands, you can switch away while a build runs.

fish (~/.config/fish/config.fish):

function __notify_long_command --on-event fish_postexec
    if test $CMD_DURATION -gt 10000
        printf '\e]777;notify;%s;finished in %ss\e\\' (string split ' ' -- $argv)[1] (math -s0 $CMD_DURATION / 1000)
    end
end

zsh (~/.zshrc):

preexec() { _cmd_start=$SECONDS; _cmd_name=${1%% *} }
precmd() {
    if (( ${_cmd_start:-$SECONDS} + 10 < SECONDS )); then
        printf '\e]777;notify;%s;finished\e\\' "$_cmd_name"
    fi
    unset _cmd_start
}

If you also use the prompt marks from Shell Integration, put both into the same precmd and preexec functions.

The bell

A bell (\a) from a program is separate from notifications:

[bell]
# none, visual (flash), attention (urgency hint while unfocused) or both.
mode = "attention"

Clone this wiki locally