Using i3 with KDE Plasma

Have you seen /r/unixporn? It’s a techie neckbeard’s wet dream in there, and I honestly can’t get enough. The subreddit is dedicated to customizing the GUI on Linux/Mac/etc.1 and posting screenshots of the results:

by /u/theblahblahmachine

by /u/GoldUtop

by /u/addy-fe

To achieve this effect, you have to tinker with all the little parts that make up the desktop environment: the window manager, the system panel, the lock screen, the display manager, and on and on and on. At this point, anyone who’s struggled with Linux before will be anticipating the avalanche of research required to grasp how the system is composed and where to even begin when all you want is to just make one simple, off-the-menu modification.

Well, I’ve done just enough research to know I don’t want to do any more, but I did manage to make my one simple, off-the-menu modification, so here it is.

Objective

Use a tiling window manager in KDE Plasma.

What is a tiling window manager?

A window manager governs how application windows are displayed on your screen. You know how you can drag a window by the title bar, maximize it, minimize it, restore it, pull up another window on top of it, and all that? A tiling window manager says “No thank you!” to all that. “Let’s make it impossible for your friends to ever use your computer without you dictating a bunch of obscure keyboard commands to them; I bet that’ll impress ’em!”

Tiling window managers are very popular on /r/unixporn. Probably the most popular one out there is i3. We’re using a variant called i3-gaps because it’s prettier.

What is KDE Plasma?

KDE Plasma is one of the two most popular desktop environments for Linux and friends (the other is Gnome). It’s clean and well-designed, with great defaults for people coming to Linux from Windows or macOS. I chose it on a whim and ended up liking it so much, I wish it were the default on major distros.

KDE comes with a window manager called KWin. This is the component we’re replacing with i3. Everything else remains the same, including:

  • system panel (for WiFi/Bluetooth/volume settings, calendar, etc.)
  • system settings app (for system-wide keyboard shortcuts, display settings, etc.)
  • notifications
  • login screen (a.k.a. display manager)
  • lock screen
  • omnisearch

Procedure

Assumptions

  1. You’re on Debian.
  2. You’re already using KDE Plasma.
    (Confirm with dpkg -s plasma-workspace.)
  3. Your default display manager (login screen) is sddm.
    (Confirm with cat /etc/X11/default-display-manager.)

If your situation is different, adjust accordingly.

Step 1: Installation

$ git clone https://github.com/maestrogerardo/i3-gaps-deb
$ cd i3-gaps-deb
$ ./i3-gaps-deb

(Non-Debian users: hopefully, you’re on one of i3-gaps’ officially supported distros.)

Step 2: i3 configuration for Plasma

Add the following lines to ~/.config/i3/config:

# Don’t treat Plasma pop-ups as full-sized windows
for_window [class="plasmashell"] floating enable

# Don’t spawn an empty window for the Plasma Desktop
for_window [title="Desktop — Plasma"] kill, floating enable, border none

# Don’t let notifications and non-interactive pop-up windows steal focus
no_focus [class="plasmashell" window_type="notification"]
no_focus [class="plasmashell" window_type="on_screen_display"]

Step 3: Login screen configuration

Now, all you need to do is add an option in the display manager (login screen) to startkde with a modified $KDEWM environment variable:

# Create a plasma + i3 launcher script
$ echo -e '#!/bin/sh\n\nKDEWM=/usr/bin/i3 startkde' > /usr/local/bin/startkde-i3
$ sudo chown root.staff /usr/local/bin/startkde-i3
$ sudo chmod 755 /usr/local/bin/startkde-i3

# Create a custom desktop sessions directory
$ sudo cp -a /usr/share/xsessions /usr/local/share/xsessions

# Create a new desktop session file for plasma + i3
$ cp /usr/local/share/xsessions/plasma.desktop /usr/local/share/xsessions/plasma-i3.desktop
$ sudo sed -i 's|/usr/bin/startkde|/usr/local/bin/startkde-i3|' /usr/local/share/xsessions/plasma-i3.desktop
$ sudo sed -i '/Name.*=/ s/$/-i3/' /usr/local/share/xsessions/plasma-i3.desktop

# Configure sddm (the login screen) to use our new desktop sessions directory
$ echo -e '\n\n[X11]\nSessionDir=/usr/local/share/xsessions' | sudo tee -a /etc/sddm.conf

Log out, and you should now be able to select “Plasma-i3” as your desktop session in the login screen. Then, head over to the official i3 user’s guide to learn the ropes.


  1. The community affectionately refers to this practice as ricing in a nod to the pejorative rice rocket in automotive culture (because it’s souped up, but only on the outside—get it?).