← 返回命令列表

Linux command

swaybg 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Set wallpaper

swaybg -i [wallpaper.jpg]

Specific output

swaybg -o [HDMI-A-1] -i [wallpaper.jpg]

Fill mode

swaybg -i [wallpaper.jpg] -m fill

Tile mode

swaybg -i [wallpaper.jpg] -m tile

Solid color

swaybg -c "[#1a1a2e]"

Center image

swaybg -i [wallpaper.jpg] -m center

说明

swaybg sets desktop wallpapers for Sway and other wlroots-based Wayland compositors. It supports displaying image files with various scaling modes (stretch, fill, fit, center, tile) or setting a solid background color using hex codes. Different wallpapers can be assigned to individual outputs by specifying the output name, enabling per-monitor backgrounds in multi-display setups. The tool runs as a persistent background process; to change the wallpaper, the running instance must be killed and a new one started with the desired settings. Swaybg is typically launched from the Sway configuration file using an `exec` directive, ensuring the wallpaper is set automatically when the compositor starts.

参数

-i, --image _FILE_
Wallpaper image.
-o, --output _OUTPUT_
Target output.
-m, --mode _MODE_
Scaling mode.
-c, --color _COLOR_
Background color.

FAQ

What is the swaybg command used for?

swaybg sets desktop wallpapers for Sway and other wlroots-based Wayland compositors. It supports displaying image files with various scaling modes (stretch, fill, fit, center, tile) or setting a solid background color using hex codes. Different wallpapers can be assigned to individual outputs by specifying the output name, enabling per-monitor backgrounds in multi-display setups. The tool runs as a persistent background process; to change the wallpaper, the running instance must be killed and a new one started with the desired settings. Swaybg is typically launched from the Sway configuration file using an `exec` directive, ensuring the wallpaper is set automatically when the compositor starts.

How do I run a basic swaybg example?

Run `swaybg -i [wallpaper.jpg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -i, --image _FILE_ do in swaybg?

Wallpaper image.