/azote

Wallpaper and colour manager for Sway, i3 and some other WMs

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Azote

This application is a part of the nwg-shell project.

Azote is a GTK+3 - based picture browser and background setter, as the frontend to the swaybg (sway/Wayland) and feh (X windows) commands. The user interface is being developed with multi-headed setups in mind. Azote also includes several colour management tools.

Packaging status

The program is confirmed to work on sway, Wayfire, i3, Openbox, Fluxbox and dwm window managers. Wayland support is limited to wlroots-based compositors. GNOME is not supported.

Azote relies on numerous external packages. Some of them determine if the program is capable of working in a certain environment (sway / another wlroots-based compositor / X11). It's up to the packager which of them come preinstalled. It's recommendable to first run azote from terminal:

  • if one of missing packages disallows Azote to work at all (e.g. xorg-xrandr or feh on X11, wlr-randr or swaybg on Wayfire), the program will display a message and terminate with exit code 1.

  • If a missing dependency just stops some feature from working, Azote will display a message and start normally.

$ azote
python-send2trash package not found - deleting pictures unavailable
Running on Wayland, but not sway
Available screen height: 1030 px; measurement delay: 5 ms

2022-05-29-125823_screenshot

Project assumptions

The most commonly used desktop background browser and setter is aimed at X windows, and does not work with wlroots-based composers. Since the swaybg command does everything we may need, it's enough to give it a GUI. In order not to limit the program usage to the single environment, Azote is also capable of using feh when running on i3, Openbox or other X11 window managers.

The description below takes into account the current master branch. All the features may or may not be available in the package already released for a certain Linux distribution. Some features rely on optional dependencies.

Main features:

  • works on Sway;
  • uses own thumbnails, 240x135px by default;
  • flips wallpapers horizontally;
  • splits wallpapers between 2 or more displays;
  • scales and crops images to detected or user-defined display dimensions;
  • generates a colour palette on the basis of an image;
  • picks a colour from the screen;
  • allows to find and edit colour definitions in .Xresources and alacritty.yml files.

Usage

Select the folder your wallpapers are stored in. If it contains a lot of big pictures, it may take some time for Azote to create thumbnails. It's being performed once per folder, unless you clear the thumbnails folder.

Most of the buttons seem to be self-explanatory, with a little help from their tooltip text. What may not be clear at first is the Apply selected picture to all screens button. It applies unchanged selected picture to all displays, regardless of whether they are currently connected/detected. It may be useful if you often connect and disconnect displays. A shortcut to this feature is just to double click a thumbnail. It'll always use the 'fill' mode, however.

Azote, as well as feh, saves a batch file to your home directory. It needs to be executed in order to set the wallpaper on subsequent logins or reboot.

sway

Edit your ~/.config/sway/config file. Replace your current wallpaper settings, like:

output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill

with:

exec ~/.azotebg

Wayfire

In ~/.config/wayfire.ini set autostart_wf_shell = false, and replace background = wf-background with background = ~/.azotebg.

Important: optional wlr-randr / wlr-randr-git and swaybg packages are necessary.

X window managers (i3, Openbox, dwm etc.)

You need to execute ~/.fehbg from your window manager’s startup file. You'll also need optional feh and xorg-xrandr packages.

Important: optional xorg-xrandr and feh packages are necessary.

dwm note:

If you start dwm from a script, it may look something like this:

# Statusbar loop
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done &

# Autostart section
~/.fehbg & 

exec dwm

Dependencies (as used in the azote AUR package):

  • python (python3)
  • python-setuptools
  • python-gobject
  • python-pillow
  • gtk3
  • python-cairo
  • python-send2trash

Optional dependencies:

  • imagemagick: for screen color picker in every environment
  • grim, slurp: for screen color picker on sway / wlroots
  • maim, slop: for screen color picker on X11
  • libappindicator-gtk3: for tray status icon
  • python-yaml: for alacritty.yml toolbox
  • swaybg: for setting background on wlroots-based compositors other than sway
  • feh: for setting background on X11-based WMs
  • xorg-xrandr: for checking outputs on X11-based WMs
  • wlr-randr (wlr-randr-git): for checking outputs on wlroots-based compositors other than sway

Please use assets from the latest release.

Seeing Arch PKGBUILD may be informative.

~/.config/azote/azoterc

{
  "thumb_width": "240",
  "columns": "3",
  "color_icon_w": "100",
  "color_icon_h": "50",
  "clip_prev_size": "30",
  "palette_quality": "10",
  "tracking_interval_seconds": "5",
  "screen_measurement_delay": "300"
}

Azote is being developed on the 1920 x 1080 box, and some graphics dimensions may not go well with other screens. The runtime configuration file allows to redefine them:

  • thumb_width - thumbnail width; changing the value triggers thumbnails regeneration on startup;
  • columns - initial number of columns in thumbnails preview;
  • color_icon_w, color_icon_h, clip_prev_size - define dimensions of pictures which represent colors in the color palette view;
  • palette_quality - affects quality and time of generation of the colour palette on the basis of an image; the less - the better, but slower; default value is 10;
  • tracking_interval_seconds - determines how often the current wallpapers folder should be checked for file addition / deletion;
  • screen_measurement_delay (ms) - introduced to resolve #108. Since Gdk.Screen.height has been deprecated, there's no reasonable way to determine the screen dimensions. We need to open a temporary window and measure its height to open the Azote window with maximum allowed vertical dimension. Different hardware and window managers need different time to accomplish the task. Increase the value if the (floating) window does not scale to the screen height. Decrease as much as possible to speed up launching Azote.

Command line arguments

$ azote -h

Azote wallpaper manager version 1.x.y

[-h] | [--help]			 Print help
[-l] | [--lang] <ln_LN> 	 Force a locale (de_DE, en_EN, fr_FR, pl_PL)
[-c] | [--clear]		 Clear unused thumbnails
[-a] | [--clear-all]		 Clear all thumbnails

Troubleshooting

[sway] My outputs use random names, wallpapers get lost after restart

Turn the "Use generic display names" preferences switch on (since v1.9.1). See #143.

No pictures in thumbnails / display preview

As well thumbnails, as displays preview inherit from the Gtk.Button class. In case you don't see images inside them, please make sure that button images are turned on in the ~/.config/gtk-3.0/settings.ini file:

[Settings]
(...)
gtk-button-images=1

'Open with...' feature doesn't work

screenshot

Azote v1.2.0 and below - no 'Open with' menu entry at all;

Azote v1.3.0 and above - the only program listed is feh.

The /usr/share/applications/mimeinfo.cache is probably missing from your system. Regenerate it:

$ sudo update-desktop-database

See https://specifications.freedesktop.org/desktop-entry-spec/0.9.5/ar01s07.html

Floating Azote window does not scale to the screen height

Since Gdk.Screen.height has been deprecated, there's no reasonable way to determine the screen dimensions. We need to open a temporary window (maximized or fullscreened on sway) and measure its height to open the Azote window with maximum allowed vertical dimension.

This does not apply to sway, where we measure the screen in another way.

In ~/.config/azote/azoterc you'll find the "screen_measurement_delay": "300" value. Different hardware and window managers need different time to open the temporary window. Increase the value if the (floating) window does not scale to the screen height. Decrease as much as possible to speed up launching Azote (and not to see the black screen on sway). On my development machine the minimum value is 30 ms on sway and 5 ms on Wayfire.

X11 / feh notice

The background color picker won't be available. You'll also be unable to select different modes ("scale", "max", "fill", "center", "tile") for certain displays. The list of modes varies from what you see in Sway ("stretch", "fit", "fill", "center", "tile").