i3wm is a tiling window manager that is powerful and resource efficient. It is used by many geeks who prefer more resources for their computers. I personally use it when I need to fire up virtualization software so my computer will have sufficient RAM for the guest OS.
Unfortunately, i3wm doesn’t provide a way/tool to set up wallpapers on our beloved computers. A fresh install of this window manager would leave us a black screen and an i3status at the bottom. Luckily today, you’ll be relieved to know that it’s possible to set wallpapers using a cool utility and lightweight program called feh.
feh is an image viewing program but it is also used as a wallpaper setting program for our case. It is lightweight and command-oriented so it’s not intended for ordinary GUI-savvy users.
If you haven’t installed the program yet, launch the terminal and key in the below command to install feh on your computer. sudo apt install feh I’m assuming you’re following this article on Ubuntu machine or on any Debian-based Linux OS.
First, we’ll see how to set an image as a static wallpaper on i3wm. I’m considering you already have a login manager program like lightdm, gdm, etc where you enter your username and password to login to your account. We’ll be editing a file called .profile in your account’s home directory. This file .profile is what your computer loads and executes when you successfully log in to your account, so generally speaking you can input more custom commands if you like to automate your work. And now we have a need to automate setting background wallpaper when i3wm starts up.
Launch your favorite text editor program and open ~/.profile file.
Add the following commands on the last line to execute feh when you successfully log in to your account. feh –bg-fill ~/Pictures/Sample_picture.jpg The directory for your image may vary but you already get the point 🙂
But what if you prefer feh loading a random wallpaper from within a directory every time you log in? This is more dramatic and refreshing as you get to enjoy different wallpapers (automatically) without having to change the command manually.
Below is a refined feh command to enable randomization when feh loads up a wallpaper for your current session:
feh --randomize --bg-fill ~/Pictures/*
Now comes the dynamic!
My first Linux distro Linux Mint Cinnamon had a wallpaper setting where I can enable random wallpapers every specific interval of time. That made my desktop look fresher and kept me quite mesmerized when I closed down all the apps to enjoy a new wallpaper scene. That functionality is also possible on i3wm but again it’ll be command-oriented 😉 And there are just too many possible ways to count the time interval before switching a new wallpaper.
However, for this article, we’ll be focusing on watch utility program. Again below is a more refined command to enable randomization and change wallpaper scene every twenty minutes. watch -n 1200 feh –randomize –bg-fill ~/Pictures/*
If you are confused with the number 1200, it’s in seconds so divide it by 60 (seconds) and you’ll get 20 minutes. But what if you prefer a shorter duration say 15 minutes? Simple, fire up your calculator and multiply your required time duration number with 60.
So we have 15 x 60 = 900.
And replacing 1200 with this new time duration will give us the below-customized command watch -n 900 feh –randomize –bg-fill ~/Pictures/*
There’ll be some geeks who don’t prefer a login manager program like lightdm or gdm but a bare terminal session and when necessary execute startx command to load his/her GUI session. In such configuration, editing .profile won’t be a solution but instead cause problematic issues because feh requires a working X11 session and your environment is otherwise.
The solution to this is to create a new file called .xsession in your account home directory and append all the step by step commands to successfully start an i3wm session. For instance: watch -n 1200 feh –randomize –bg-fill ~/Pictures/* &
# more commands and then finally your window manager
There you go. I hope this article has been helpful in eradicating a common issue you encountered with i3wm. By the way, there are more cool tricks with this window manager such as theming its window looks and feel, setting keyboard shortcuts, customizing i3status, etc. Hopefully, in my next article, I’ll be writing about how to beautify i3 program windows ie., look and feel. Please do share your views and opinions in the comment section below. I’d be glad to read them 🙂