Arch Linux

KDE/Plasma with i3wm on Arch After Plasma 5.25 Update

In the past, using KDE with a custom window manager was as simple as making a custom desktop entry for it in /usr/share/xsessions. With the latest Plasma update, this has changed.

What’s DE? 

A desktop environment (DE) is the graphical interface for your Linux workstation. It is an element that works independent of the underlying system. Multiple DEs can be installed on the same system. The DE handles all the conveniences that many users want from a desktop or laptop computer. Most standard DE installations have tools to manage the WiFi, printing, appearance, and Bluetooth, among others. Popular DEs are KDE, Xfce, and Gnome.

What’s WM?

A window manager (WM) is a lower level tool to manage your GUI system. WMs are part of every DE, but they can also be used as stand-alone at login. The WM is responsible for interfacing with the X server providing your display. Window managers are most commonly tiling or stacking.

A stacking WM is what you see traditionally where the windows can be dragged, overlapped, resized, and so on. Kwin is the stacking WM included in the KDE desktop environment. When using KDE, you will be using Kwin to manage your applications’ windows by default.

With a tiling WM, windows are laid out in a way that gives a flat space to each window. They are almost never dragged or overlapping. A popular stand-alone tiling WM is the i3wm (or i3). The i3 has a steep learning curve and extensive configuration file. But the WM provides a great tiled workflow for anyone more keyboard-centric. However, i3 as a stand-alone WM lacks all the bells and whistles that a full DE provides.

What if you want the tiled workflow of i3wm yet you need the extra features of the KDE desktop environment?

Using a Custom WM with KDE

Again, KDE uses Kwin by default to display the windows. Here, we will replace Kwin with i3 for a tiled KDE experience.

If KDE is not installed in your system, do so with the following command:

$ sudo pacman -S plasma-meta

If you don’t have a desktop manager yet like SDDM, LightDM, or GDM, install using the following commands:

$ sudo pacman -S sddm
$ sudo systemctl enable --now sddm

Install the i3 package using the following command:

$ sudo pacman -S i3wm

Log out and log into i3 to configure it for the first time:

https://i3wm.org/docs/userguide.html#configuring

Since KDE 5.25 systemd manages the KDE’s default window manager, we must mask the Kwin service:

$ systemctl --user mask plasma-kwin_x11.service

Now, create your own systemd user script to enable i3:

$ vim ~/.config/systemd/user/plasma-i3.service

“
[Install]
WantedBy=plasma.workspace.target

[Unit]
Description=i3wm
Before=plasma.workspace.target

[Service]
ExecStart=/usr/bin/i3
Slice=session.slice
Restart=on-failure
“

$ systemctl --user enable plasma-i3.service

Note: Never use sudo when running the following command:

$ systemctl --user [command]

Log out or reboot. When you log back into KDE, i3 is used in place of Kwin.

i3 Configuration

There are some additions that you might want to make to your i3 configuration to make the experience smoother and more integrated:

$ vim ~/.config/i3/config

“
# for KDE integration
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable

for_window [class="yakuake"] floating enable
for_window [class="systemsettings"] floating enable
for_window [class="plasmashell"] floating enable
for_window [class="Plasma"] floating enable; border none
for_window [title="plasma-desktop"] floating enable; border none
for_window [class="krunner"] floating enable; border none
for_window [class="Kmix"] floating enable; border none
for_window [class="Klipper"] floating enable; border none
for_window [class="Plasmoidviewer"] floating enable; border none
for_window [class="plasmashell" window_type="notification"] border none; move postiion 1450px 20px
no_focus [class="plasmashell" window_type="notification"]
for_window [title="Desktop — Plasma"] kill; floating enable; border none
for_window [title="Save File — KDialog"] floating disable
for_window [class="kinfocenter"] floating enable
for_window [instance="_scratchpad"] floating enable
for_window [window_type="menu"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_role="About"] floating enable
for_window [window_role="bubble"] floating enable
“

To learn more about i3, its bindings, and its configuration file, visit the following page:

i3 User’s Guide

Conclusion

In the past, there was a pretty straightforward technique to use i3 with KDE. Since the update to 5.25, systemd manages the WM and changes must be done with systemd user scripts. This setup places the keyboard driven i3 into an elegant KDE session. The i3 has a steep learning curve, but once you get the hang of it, it can be a very productive way to use KDE.

About the author

Joseph M Gant

Joseph M Gant is a professional poet, fiction writer, and cyber-activist. His creative work has appeared widely in small and academic press, and his technical writing has appeared in various cybersecurity blogs. He is an Arch linux enthusiast of 10 years, EFF supporter, and self-confessed datahoarder.
Find him on Twitter or on Github