# Qtile Window Manager


<img src="/images/qtile.png" alt="Qtile" width="150px" style="float: left; margin-right: 10px; margin-bottom: 10px;" />

For most people, their window manager is something they probably don't think
much about. Consider all of the Windows and Mac users out there. They may
or may not think about the fact that they appreciate how using Windows is
different from using a Mac, but they may not be able to explain exactly why
(Though over the past few years, it feels like Mac and Windows interfaces are
slowing becoming very similar).

But on Linux, there is a lot of choice of window managers: from KDE & Gnome
(similar to the traditional Windows/Mac interfaces) to tiling window managers
like DWM, Xmonad, and Qtile.

# Tiling Window Managers

Years ago, when I was running OpenBSD on my Thinkpad T42, I used DWM, Spectrwm,
and CWM on my laptop. I loved them.  I loved the ability to control just about
every aspect of my desktop environment with the keyboard.  But as I stated in
[my post about using Arch Linux](/technical/arch-linux), I eventually
stopped using OpenBSD on my laptop because it was mostly too sluggish when
surfing the web. And now I can't use it because of my NVIDIA GPU.

# Gnome
Probably like many new Linux Desktop users, I started with a distribution that
comes with Gnome (Ubuntu or Fedora). Gnome is fine. There's nothing special
to it. I particularly liked Fedora's implementation, which is plain vanilla
Gnome. I used it for a while (maybe a year) before getting bored.

# KDE
A looooooooong time ago (in the 90s or 2000s), I played around with KDE along
with Gnome. Back in those days, neither desktop was very good and felt very
Linux-y. I've seen screenshots of KDE/Plasma and am really impressed. It's a
very nice looking Windows-like desktop. I think if I weren't using a tiling
window manager, I may have switched from Gnome to KDE/Plasma.

# XFCE
As far as traditional stacking window managers go, XFCE is my favorite. I used
that for several months (maybe six or more) before realizing what I really
wanted was a tiling window manager.

I really like how minimalistic XFCE can be. It's highly configurable and I
thoroughly enjoyed using it -- especially on my Arch install.

But what I really wanted was a tiling window manager.

# DWM
I'd used DWM before. I really liked it. It's simple. It works. But it's hard to
configure. Out of the box, DWM does not come with many features. Any features
you want to add, must be compiled in using patches. Some, in my opinion, should
be included in base DWM (like center, color-emoji, ipc, restartsig, steam,
systray, and warp).

I had my DWM config set up and patched the way I liked it, but I really
started to worry about what would happen when DWM got updated. I did not like
the idea of having to re-apply all of the patches to make everything work
again.

Stein Gunnar Bakkeby has created [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch)
which highly simplifies patching DWM, but I still had concerns about upgrade time.

# Xmonad

I tried to give Xmonad a try, but I just can't (and don't want to) learn
Haskell.

# Others

I gave bspwm, awesomewm, herbstluftwm, i3, and a couple others a try, but
ultimately was left unsatisfied.

---

# Qtile

Finally, I tried Qtile.

## Groups

It's great. It really is. The biggest issue I had to overcome was how it
handles its groups (workspaces) across multiple monitors. With DWM and two
monitors, you get a set of tags (like groups) on each monitor. You can move
windows from one monitor to the other, but Monitor 1 Tag 1 is not the same as
Monitor 2 Tag 2.

With Qtile, you get a set of groups (I am using 1-9, 0, -, and = for a total of
12 groups). That's it. Whether you have one, two, or ten monitors, you have
that finite number of groups. Don't get me wrong, you can have virtually as
many groups as your keyboard can handle. At one time I had both the number row
and the next row of keys for groups (so "1"-"=" and "q"-"o" -- leaving "p" for
something else). But I have since simplified to "1"-"=".

Let's say Group "1" is selected on Montor 1. And Group "-" is selected on
Monitor 2. While Monitor 1 is selected, if I try to switch to Group "-",
it swaps with Monitor 2 so Monitor 1 would have "-" and Monitor 2 would now
have "1". It's a big jarring at first, but you eventually get used to it.

## Workflow

### DWM
Using DWM, let's say I am using Monitor 1 Tag "1" for my terminal,
Monitor 2 Tag "2" for my browser, and Monitor 2 Tag "3" for the Youtube Desktop
App. Then, while I'm watching a video on Youtube, I see something that I want
to do a search on with my browser without stopping my view of the video.

I would need to switch Monitor 1 from Tag 1 to a tag with nothing in it. Then
I would switch to Monitor 2 and move the Youtube window over to Monitor 1,
which means that it changes from Monitor 2 to Monitor 1 (interrupting my view
slightly). Then I could change Monitor 2 to Tag 2 where my browser is. But then
going back to my terminal would require moving Youtube back to Monitor 2 and
so on.

### Qtile
With window managers that share Groups/Tags/Workspaces like Qtile and Xmonad,
the above scenario plays out much more nicely. Terminal in Group 1. Browser in
Group 2. Youtube in Group 3. Monitor 1 has Group 1 selected and Monitor 2 has
Group 3 selected. When I want to go to my browser while keeping the video going
I simply make sure Monitor 1 is selected and change from Group 1 to Group 2.

My main work mode is: Monitor 1 has Group 1 (my terminal) selected and
Monitor 2 has Group 2 (my browser) selected. But having the flexibility of
having any Group on any monitor is SO great.

## Configuration

Qtile is written in Python and uses Python for its configuration file. I'm not
super excited about a program using a programming language for a
configuration file, but at least its a relatively easy to understand language
that I already know [Xmonad, what were you thinking? ;-)].

{{< figure src="/images/qtile-cfg-1.png" alt="Qtile Config" >}}

As with many things, I try to stay pretty close to the stock way of using
something, but I have made several changes to Qtile's default configuration.
You can view my
[configuration file](https://github.com/merdely/dotfiles/blob/main/.config/qtile/config.py)
on GitHub.

## The Bar

Qtile has a bar that can be on top or bottom. The bar consists of widgets that
can do anything from: display the Qtile Groups; display the current application
title; show the volume, disk space, weather, battery info, available package
updates; date/time; ...  The bar can also have a "SysTray" which includes the
little applet icons some applications use.

{{< figure src="/images/qtile-bar-1.png" alt="Qtile Bar" >}}

The bar is highly customizable, can be on top or bottom (or maybe both?). And
you can have the same or different bars on different monitors (though the
SysTray needs to be on a single monitor.

{{< figure src="/images/qtile-bar-2.png" alt="Qtile Bar 2" >}}

# Conclusion

I'm extremely happy with Qtile. I've been running it now for about six months.
A couple of times I ran into problems (which I'll write up soon) which caused
me to look and test at other window managers (like Herbstluftwm), but with
some focused effort, I was able to solve those problems (Steam windows and
cursor warp across two monitors are two that particularly bothered me).

If you like tiling window managers, I highly recommend giving Qtile a try. I
was also worried Qtile would be slow given that Python is not the fastest
language out there, but I have been very happy with its performance.

