Awesome Window Manager: Part 5


When customising your desktop, the thing that stands out the most is your wallpaper. It takes up the most pixels on your screen after all, and when it comes to setting a wallpaper on Linux on a normal desktop environment, you have more than a few options. When using a window manager, however, I find these methods easier.


If you wish to set a specific wallpaper image for each screen you have, you can use a program called "Nitrogen".

First install it:

1sudo pacman -S nitrogen

You can use Rofi to locate and launch it, Press Super + Space, and type nitrogen

Nitrogen is a user-friendly way to set a wallpaper.

Nitrogen is a user-friendly way to set a wallpaper.

The app is pretty self-explanatory, so I won't go in depth here. It provides you with an easy-to-understand preferences window where you can add/remove wallpaper folders, choose which images to display on each screen and how they display.

You can add Nitrogen to your script so that your wallpaper is set for you once you log in.

At the bottom of your add the following command:

1# Nitrogen wallpaper
2run nitrogen --restore


If you have hundreds of wallpaper images on your hard drive, and you want to set a specific folder to use for random wallpapers - the easiest way I've found to do this is by using feh and a Bash script.


1sudo pacman -S feh

I first categorised my images into their own sub-folders like this, keeping folder names short and without using empty spaces in the names.

 2  ├── wallpaper/
 3  │   ├── abstract
 4  │   ├── animals
 5  │   ├── cars
 6  │   ├── cyberpunk
 7  │   ├── fantasy
 8  │   ├── funny
 9  │   ├── nature
10  │   ├── neon
11  │   ├── scenic
12  │   ├── sci-fi
13  │   ├── space
14  │   ├── super_hero
15  │   ├── wallhaven

I then created a script which will allow me to choose one of those folder names using Rofi, and then have feh pick random images from that folder to use as a wallpaper.

The script will tell Rofi to present you with a list of all the subfolders contained in the path set in the $WALLPAPERS variable. Once you select a folder name, the script will save the selected path to that folder to a file name $HOME/.feh_walpath. This is then used by a second script which we can bind to a hotkey in sxhkd to quickly set random wallpapers.

Set Wallpaper Folder Script

If you don't already - ensure you have exa (a ls replacement) installed.

1sudo pacman -S exa

Save the script below to: ~/.scripts/

 1#!/usr/bin/env bash
 2# Description: 
 3# We use exa to list only directories to Rofi, and present a list to the user to select them.
 4# Once a folder is selected, a random image is selected for use as a wallpaper using feh, 
 5# and the selected path is output to '.feh_walpath'.
 6# Dependencies: feh, exa, rofi
 8# Set path to wallpaper main folder here.
10# cd to the path provided above.
12## List only image sub-directories in Rofi using 'exa -D'.
13SELECTED=$(exa -D $WALLPAPERS|rofi -dmenu -p "Random Wallpaper Folder")&& feh --bg-max --randomize "$SELECTED"/*
14# Notify user that theme folder has been set.
15notify-send -i "/usr/share/icons/gnome/24x24/apps/preferences-desktop-wallpaper.png" "Wallpaper Theme Folder:" $SELECTED
16# Concatenate our main wallpaper path with the one selected by the user via Rofi, then save the path to '~/.feh_walpath'
17cd ~
18echo $WALLPAPERS$SELECTED >$HOME/.feh_walpath

Set Wallpaper Script

Save the script below to: ~/.scripts/

1#!/usr/bin/env bash
2# Description: 
3# The folder path in "~/.feh_walpath" is read by "~/.scripts/" 
4# which then picks random images from within the folder using feh.
7feh --no-fehbg --bg-max --recursive --randomize $WALLPAPERPATH*

Adding Wallpaper Scripts To sxhkd

We can then bind both of those scripts to hot keys by adding them to ~/.config/sxhkd/sxhkdrc:

 2# Wallpaper
 5# Select Wallpaper Theme Folder
 6super + e
 7    ~/.scripts/
 9# Set Random Wallpaper
10super + r
11    ~/.scripts/

Save the changes to your sxhdrc file, and then reset the sxhkd daemon by pressing Super + Shift + x.

Ensure that both scripts have execute permissions set:

1cd ~/.scripts/
2chmod +x

You should now be able to select a wallpaper theme folder with Rofi by pressing Super + e. To quickly set random wallpapers from the last selected theme folder, press Super + r.