The Beginner’s guide to the Xmonad window manager
Xmonad is a dynamic, tiling window manager for X11. It runs on Linux and other Unix-like operating systems. It’s a favorite in the programming community, as it is minimal, has dozens of excellent features, and supports a massive extension library. Here’s how to set up Xmonad on your Linux system.
Install Xmonad on Linux
The Xmonad window manager is one of the oldest on all of Linux. As a result, it is effortless to install on a variety of distributions. In this section of the guide, we will demonstrate exactly how to install the Xmonad window manager on Linux.
To start the installation, launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the command-line instructions outlined below that correspond with the Linux OS you use.
Ubuntu
Ubuntu users looking to get their hands on the Xmonad window manager will first need to enable the “Universe” software repository. To do that, use the following add-apt-repository command.
sudo add-apt-repository universe
After adding the “Universe” software repository, you must run the update command to refresh Ubuntu’s software sources.
sudo apt update
Following the update command, use the Apt package manager to load up the latest version of the Xmonad window manager on your Ubuntu Linux PC.
sudo apt install xmonad dmenu feh
Debian
To install Xmonad on Debian Linux, use the Apt-get command below in a terminal window.
sudo apt-get install xmonad dmenu feh
Arch Linux
On Arch Linux, the Xmonad window manager is available to users in the “Community” software repository. Ensure you have “Community” enabled. Then, use the Pacman package manager to install Xmonad.
sudo pacman -S xmonad dmenu feh
Fedora
Fedora Linux users can install the latest version of Xmonad via the Dnf package manager.
sudo dnf install xmonad dmenu feh
OpenSUSE
On OpenSUSE Linux, the Xmonad window manager is installable with the following Zypper command.
sudo zypper install xmonad dmenu feh
Generic Linux
The source code for Xmonad is available for free on their website. If you’re running a lesser-known Linux operating system and want to get Xmonad working, head over to this page here to learn what to do.
Logging into Xmonad
Xmonad can be accessed from the login screen under sessions like any other window manager or desktop environment. To load up Xmonad, log out of your current desktop environment, and return to the login screen.
Once on the login screen, locate the session area. The session area may say “Sessions,” or be a gear or icon. Inside of the session area, find “Xmonad” and click on it with the mouse to tell your Linux PC to load Xmonad.
Upon logging into Xmonad, you will see a black screen with a message that pops up on the screen. This message gives you the keyboard shortcut to launch a terminal (Ctrl + Shift + Enter). Press it, as it is needed to configure Xmonad in the next section of the guide.
Configuring Xmonad
Xmonad must be configured to run correctly. To configure it, you must generate a config file. To do this, go to the terminal and use the wget download command to download the default configuration file to your Linux PC.
wget https://pastebin.com/raw/zbLbxqst -O xmonad.hs
After downloading the Xmonad default configuration file, move it to the “Xmonad” folder. Do not worry if there is already an “xmonad.hs” file in the folder, as it probably isn’t as intricate or with as many features enabled.
mv xmonad.hs ~/.xmonad/
Once the file is in the “.xmonad” folder, reload the configuration into the Xmonad window manager by pressing Ctrl + Q.
Using Xmonad
Xmonad is a tiling window manager that is heavily based on keyboard shortcuts. Here are the basic keyboard shortcuts that will help you navigate the system.
- Left Alt + P: opens up Dmenu, which you can use to launch apps quickly.
- Left Alt + Shift + Q: logs out of the Xmonad system.
- Left Alt + Shift + C: kills currently focused window.
- Left Alt + Spacebar: rotate the windows through various tiling layouts.
- Left Alt + J: switch to the next window.
- Left Alt + K: switch to the previous window.
- Left Alt + number row (1-0): switch between workspaces.
By learning these keyboard shortcuts, Xmonad will be very easy to use. If you’d like to know even more shortcuts, check out the official web page for Xmonad here.
Setting the Xmonad wallpaper
Xmonad starts with a blank wallpaper. If you want to set your wallpaper, you will need to follow the instructions below.
First, create a file called “xmonad-wallpaper-set”. This is a script file that will be placed in “/usr/bin,/” which will handle the setting of your wallpaper. Using the touch command, make the new file.
Note: “xmonad-wallpaper-set” is already configured in the “xmonad.hs” file, so no need to tinker with it to get it to set the wallpaper.
touch xmonad-wallpaper-set
Next, use the echo command to add in the “shebang” into the top of the script file.
echo '#!/bin/bash' >> xmonad-wallpaper-set
After adding in the “shebang,” make a new line in the file.
echo ' ' >> xmonad-wallpaper-set
Add in the command that will automatically set your wallpaper.
echo 'feh --bg-scale ~/wallpaper.*' >> xmonad-wallpaper-set
Update the permissions of the file with:
sudo chmod +x xmonad-wallpaper-set
Place the file in the “/usr/bin/” directory with the mv command.
sudo mv xmonad-wallpaper-set /usr/bin/
Once the “xmonad-wallpaper-set” script is in the “/usr/bin/” directory, the hard work is done. Now, press Left Alt + P to open Dmenu. Then, launch Firefox (or another browser) and download your favorite wallpaper.
Make sure the file is either a PNG, JPG, or JPEG, and save it in your home directory as “wallpaper.png,” “wallpaper.jpg,” or “wallpaper.jpeg.”
Warning: do not have multiple files named “wallpaper” in the home directory. Only one at a time!
When you’ve finished downloading the wallpaper, press Left Alt + Q to apply it to the system.
More information about Xmonad
There are so many things that you can do with the Xmonad tiling window manager. We’ve only scratched the surface with this tutorial. If you’d like to learn more about Xmonad, check out the website here.