LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

swaynag

Shows warning or error messages with buttons on Sway

TLDR

Show a simple warning message
$ swaynag -m "[Low battery]"
copy
Show an error (uses the red error style)
$ swaynag -t error -m "[Disk full]"
copy
Add a button that runs a command
$ swaynag -m "[Reboot required]" -b "[Reboot]" "[systemctl reboot]"
copy
Read a detailed message from stdin and show a toggle
$ dmesg | swaynag -m "[Kernel messages]" -l
copy
Anchor the bar at the bottom of the screen
$ swaynag -m "[Bottom notice]" -e bottom
copy
Target a specific output
$ swaynag -m "[Hello]" -o [HDMI-A-1]
copy
Use a custom config file
$ swaynag -c [path/to/config] -m "[Hi]"
copy

SYNOPSIS

swaynag [options...]

DESCRIPTION

swaynag is the Sway compositor's on-screen message dialog. It draws a bar across the top or bottom of a screen with a message, an optional detailed body, and optional buttons. Sway itself invokes swaynag to surface configuration errors or important warnings, but users and scripts may call it directly to display confirmations, reboot prompts, or custom alerts.The tool uses the wlr-layer-shell protocol, so it is specific to Wayland compositors that implement that protocol (Sway and other wlroots-based compositors).

PARAMETERS

-m, --message text

Message to display.
-l, --detailed-message
Read a detailed message from standard input; adds a button that toggles the detailed text.
-L, --detailed-button text
Text for the detailed-message toggle button (default: Toggle details).
-t, --type name
Message type (error, warning, or a custom one defined in the config). Each type has its own colors.
-e, --edge top|bottom
Screen edge on which to anchor (default: top).
-y, --layer overlay|top|bottom|background
wlr-layer-shell layer used (default: overlay).
-o, --output name
Name of the xdg_output on which to show the bar.
-b, --button text command
Add a button that runs command in a terminal when pressed. Repeatable.
-B, --button-no-terminal text command
As -b but runs command without a terminal.
-z, --button-dismiss text command
Button that runs command and then dismisses swaynag.
-Z, --button-dismiss-no-terminal text command
Same as -z but without a terminal.
-s, --dismiss-button text
Text for the dismiss (close) button (default: X).
-f, --font font
Pango font description.
-c, --config file
Load configuration from file.
-v, --version
Print version and exit.
-h, --help
Show help and exit.

CONFIGURATION

swaynag loads the first readable file from:

$ $HOME/.swaynag/config
$XDG_CONFIG_HOME/swaynag/config
SYSCONFDIR/swaynag/config
copy
Config files use INI-style sections. The section name corresponds to the value of -t/--type; [<default>] applies to all types. Typical keys control colors, borders, padding, fonts, layer, and default buttons. See swaynag(5) for the full schema.

HISTORY

swaynag is part of the Sway compositor, a tiling Wayland compositor compatible with i3. Sway was started by Drew DeVault in 2015; swaynag was added as the replacement for the i3 nagbar that Sway historically launched for configuration errors.

SEE ALSO

sway(1), swaymsg(1), swaybar(5), swaynag(5)

Copied to clipboard
Kai