Set a different wallpaper for the background of each Sway workspace - packaged for debian
Find a file
2025-08-18 13:24:05 -07:00
deps Fix niri compatibility, add versioned niri-ipc dependencies 2025-06-01 13:39:50 +02:00
scripts Update PKGBUILD templating script 2025-06-01 14:01:04 +02:00
src implement specifying wallpaper by workspace number 2025-08-18 13:05:11 -07:00
.editorconfig Add .editorconfig based on the Rust language repository 2024-09-30 20:19:42 +02:00
.gitignore Initial commit 2023-04-07 17:25:48 +02:00
.gitmodules Update dependencies, rm fast_image_resize submod. 2023-05-05 08:26:41 +02:00
Cargo.lock Prepare release 0.2.2 2025-06-15 21:24:56 +02:00
Cargo.toml debian packaging info 2025-08-18 13:24:05 -07:00
CHANGELOG.md Prepare release 0.2.2 2025-06-15 21:24:56 +02:00
LICENSE-APACHE Formatting only - apply added editorconfig to all files 2024-09-30 20:29:09 +02:00
LICENSE-MIT Rename project to multibg-wayland, update documentation 2025-04-26 17:07:40 +02:00
PKGBUILD Update PKGBUILD to 0.2.2 release 2025-06-15 21:29:23 +02:00
PKGBUILD.in Correct PKGBUILD by adding conflicts and provides multibg-sway 2025-06-01 13:48:16 +02:00
README.md Fix niri compatibility, add versioned niri-ipc dependencies 2025-06-01 13:39:50 +02:00
rustfmt.toml Format code 2025-04-23 15:21:51 +02:00

multibg-wayland

Set a different wallpaper for the background of each Sway / Hyprland / niri workspace

News

Project is being renamed to multibg-wayland to signify support for Wayland compositors other than Sway. The name multibg-sway remains as an alias or redirect.

Usage

$ multibg-wayland <WALLPAPER_DIR>

Wallpapers should be arranged in the following directory structure:

wallpaper_dir/output/workspace_name.{jpg|png|...}

Such as:

~/my_wallpapers/HDMI-A-1/1.jpg

In more detail:

  • wallpaper_dir: A directory, this will be the command line argument

  • output: A directory with the same name as a Wayland output such as eDP-1, HDMI-A-1

    • For multiple outputs this can be a symlink to the directory of an other output.

    • Get the name of current outputs from the compositor with these Sway / Hyprland / niri commands:

      $ swaymsg -t get_outputs
      $ hyprctl monitors
      $ niri msg outputs
      
  • workspace_name: The name of the workspace, by default use the compositors assigned workspace numbers as names: 1, 2, 3, ..., 10

    • Can be the name of a named workspace usually defined in the config file of the compositor. (Renaming workspaces while multibg-workspace is running might not be supported yet.)
    • Can define a fallback wallpaper with the special name: _default
    • Can be a symlink to the wallpaper of an other workspace

Example

For one having a laptop with a built-in display eDP-1 and an external monitor HDMI-A-1, wallpapers can be arranged such as:

~/my_wallpapers
    ├─ eDP-1
    │    ├─ _default.jpg
    │    ├─ 1.jpg
    │    ├─ 2.png
    │    └─ browser.jpg
    └─ HDMI-A-1
         ├─ 1.jpg
         └─ 3.png

Then start multibg-wayland:

$ multibg-wayland ~/my_wallpapers

Options

In case of errors we log to stderr and try to continue. Redirect stderr to a log file if necessary.

By default, without the --gpu option only CPU memory is used to store wallpapers, shared with the Wayland compositor. (All of this might be reported as memory used by the compositor process instead of our process.)

With the --gpu option set GPU memory (again, shared with the compositor) is used. This requires Vulkan loader and driver with Vulkan 1.1 or newer, and might save a few milliseconds latency on wallpaper switches avoiding the use of CPU memory and PCIe bandwidth. (I recommend to try this out, I just can't test it with many GPUs.)

The running Wayland compositor is autodetected based on environment variables. If this fails then try to set the --compositor {sway|hyprland|niri} command line option.

It is recommended to resize the wallpapers to the resolution of the output and color adjust with dedicated tools like imagemagick or gimp.

This app can do some imperfect image processing at the expense of startup time. Wallpaper images with different resolution than their output are resized (with high quality filter but incorrect gamma) to fill the output. Contrast and brightness (on some bad arbitrary scale) might be adjusted such as:

$ multibg-wayland --contrast=-25 --brightness=-60 ~/my_wallpapers

Resource usage

For active outputs all wallpapers from the corresponding wallpaper_dir/output are loaded and stored uncompressed to enable fast wallpaper switching. Wallpapers with multiple symlinks pointing to it are only loaded once and shared. For example for 10 unique full HD wallpaper this means 10*1920*1080*4 = 83 MB memory use.

Installation

Requires Rust, get it from your package manager or from the official website: https://www.rust-lang.org/tools/install

  • Latest release (from crates.io) with Cargo install provided by Rust:

    $ cargo install --locked multibg-wayland
    

    Run ~/.cargo/bin/multibg-wayland

  • Directly from the current git source:

    $ git clone https://github.com/gergo-salyi/multibg-wayland.git
    $ cd multibg-wayland
    $ cargo build --release --locked
    

    Run ./target/release/multibg-wayland

  • For Arch Linux from AUR: https://aur.archlinux.org/packages/multibg-wayland

    • eg. with paru

      $ paru -S multibg-wayland
      

Bug reporting

Reports on any problems are appreciated, look for an existing or open a new issue at https://github.com/gergo-salyi/multibg-wayland/issues

Please include a verbose log from you terminal by running with RUST_BACKTRACE=1 and RUST_LOG=info,multibg_wayland=trace environment variables set, such as

$ export RUST_BACKTRACE=1
$ export RUST_LOG=info,multibg_wayland=trace
$ multibg-wayland ~/my_wallpapers

If using the --gpu option also consider installing Vulkan validation layers from your distro. It which will be automatically enabled at the log levels defined above.

Alternatives

License

Source files in this project (except vendored dependencies under deps/) are distributed under MIT OR Apache-2.0.

Vendored dependencies under deps/ are distributed under their respective licenses.

Objects resulting from building this project might be under GPL-3.0-or-later due to licenses of statically linked dependencies. Open an issue if you need compile time features gating such dependencies.