Linux command
swaynag 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show a simple warning
swaynag -m "[Low battery]"
Show an error
swaynag -t error -m "[Disk full]"
Add a button
swaynag -m "[Reboot required]" -b "[Reboot]" "[systemctl reboot]"
Read a detailed message from stdin
dmesg | swaynag -m "[Kernel messages]" -l
Anchor the bar at the bottom
swaynag -m "[Bottom notice]" -e bottom
Target a specific output
swaynag -m "[Hello]" -o [HDMI-A-1]
Use a custom config
swaynag -c [path/to/config] -m "[Hi]"
说明
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).
参数
- -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.
FAQ
What is the swaynag command used for?
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).
How do I run a basic swaynag example?
Run `swaynag -m "[Low battery]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -m, --message _text_ do in swaynag?
Message to display.