LinuxCommandLibrary

i3-nagbar

Display urgent i3 window manager messages

TLDR

Display an error

$ i3-nagbar [[-m|--message]] "[error message]"
copy

Display a warning
$ i3-nagbar [[-t|--type]] warning [[-m|--message]] "[warning message]"
copy

Use the specified font
$ i3-nagbar [[-f|--font]] "[pango:monospace bold 9]" [[-m|--message]] "[error message]"
copy

Create a button and run a command in a terminal on click
$ i3-nagbar [[-b|--button]] "[button text]" [command] [[-m|--message]] "[error message]"
copy

Create a button and run a command on click
$ i3-nagbar [[-B|--button-no-terminal]] "[button text]" [command] [[-m|--message]] "[error message]"
copy

Always open i3-nagbar on the primary monitor (default: focused monitor)
$ i3-nagbar [[-pm|--primary --message]] "[error message]"
copy

SYNOPSIS

i3-nagbar [-h | -v | -m message | -T title | -t timeout | -c close-text]

PARAMETERS

-h, --help
    Display help message and exit.

-v, --version
    Display version information and exit.

-m message, --message=message
    Main message text to display in the bar (required for display).

-T title, --title=title
    Optional title text above the message.

-t timeout, --timeout=timeout
    Auto-dismiss after timeout ms (default: 10000; 0 disables).

-c close-text, --close-text=close-text
    Text on the close button (default: "Close").

DESCRIPTION

i3-nagbar is a lightweight utility from the i3 tiling window manager that displays a semi-transparent bar at the top of the screen. It shows a user-defined title and message, along with a close button, ideal for notifying about urgent windows or events.

Commonly configured in i3's config file using for_window [urgent] exec i3-nagbar ..., it pops up when applications mark windows as urgent (e.g., flashing terminals with errors). The bar remains until closed manually or timed out, helping users not miss important alerts in a minimalistic WM environment.

Customizable via options for message, title, timeout, and button text, it integrates seamlessly with i3's keyboard-driven workflow. Clicking the bar or button dismisses it without additional actions, relying on i3 bindings for handling urgents like i3-msg [urgent] focus. Simple, non-intrusive, and X11-specific.

CAVEATS

Requires i3 window manager; bar fixed at screen top; no click actions beyond close; X11-only, not Wayland-compatible.

TYPICAL CONFIG USAGE

In ~/.config/i3/config:
for_window [urgent] exec --no-startup-id i3-nagbar -t 2000 -m 'You have {{id_label}} urgent windows.'

BEHAVIOR NOTES

Supports Pango markup in texts for formatting; multiple invocations stack vertically; uses i3's font config.

HISTORY

Developed by Michael Stapelberg for i3wm around 2010; stable since early i3 versions (pre-4.x); remains in current releases (4.22+) for legacy urgent notifications.

SEE ALSO

i3(1), i3-msg(1), i3bar(1)

Copied to clipboard