I3wm on Librem laptops and PureOS


#1

Hey all,

After having a few frustrations with GNOME, I started shopping around for other Desktop Environments (DE) that might better suit my needs. (As a side note, Purism’s staff has been very helpful in trying to suss out the issue with GNOME.) I rather like the look and feel of GNOME, but it’s a pretty heavy DE, and it was eating up resources among other issues I was having. I was consistently having laggy video playback, despite having 16GB of RAM and nearly 0.5TB of free space.

So then I found i3wm. For those who don’t know, it’s a really pared down DE. In fact, you can barely call it a DE, and most folks call it a Window Manager only. It’s definitely not beginner friendly, but after I got it customized to my liking, it’s been a pretty pleasant experience.

Documentation on i3wm customization is a little scant, especially if you’re really interested in the look and feel, so I wanted to make this post to serve as a resource to anyone else that wants to try it out. There are a couple of pain points, and some unexpected things, especially for folks using Librem laptops, but hopefully I can alleviate some of those. I’m also hoping others that have given this a shot can add to this post with their solutions.

For basic installation, I recommend taking a look at this video series, as I’m only going to go through stuff I had a hard time finding: https://www.youtube.com/watch?v=j1I63wGcvU4

Note:

I have a lot of short, custom scripts in my setup, so I’ll put them in a gist, and you can find your way around hopefully.

Sexy i3bar:

So the default i3bar that comes with i3wm is pretty ugly. I found some nice stuff to really bring it into its own. First of all, you’ll want i3blocks. Now, the regular i3blocks in the PureOS repos is a little out of date, so I got this one from github and built it myself: https://github.com/vivien/i3blocks

This is necessary because the older version doesn’t allow for custom properties, which a lot of the nicer “blocklets” use.

Speaking of blocklets, I really recommend getting: https://github.com/vivien/i3blocks-contrib

It has quite a few really nice i3blocks extensions. However, it doesn’t have everything, and not everything works out of the box. I’m going to detail what I added in order of how it appears in my i3blocks.conf file.

Weather:

I found this nice blocklet: https://github.com/nikhil/IconicWeather

However, it doesn’t work out of the box for some reason, so I had to do some weird stuff in the configuration:

[IconicWeather]
command=echo $(/home/<YOURNAME>/IconicWeather/IconicWeather.sh <YOUR ZIP CODE>)
interval=600 # update every 10 minutes

Screen brightness display:

I had to make a custom script for this. See the section on screen brightness below for info about the script. The configuration is as follow:

[brightness]
label= 
interval=once
signal=2

Volume:

You might notice the signal property. This is so we can update this blocklet only when the volume changes, as opposed to polling for a set interval. I’ll have more about that further down.

[volume-pulseaudio]
interval=once
signal=1
LONG_FORMAT="${SYMB} ${VOL}%"

Wifi strength:

Most of the docs on the wifi blocklet don’t reflect the wifi interface in Librem laptops, or at least not the one I have. This is what worked for me:

[wifi]
label=
INTERFACE=wlp1s0
interval=10

Screensaver:

i3wm doesn’t come with any screensaver utilities. So, you kind of have to roll your own. Personally, I like my screen to go dark when it idles, then go right to a lock screen when it wakes up. That was a bit of a pain to figure out, but this is what I got so far.

Put this in .config/i3/config file:

exec xset s 60
exec xset dpms 0 300 7200
exec xss-lock -- /home/<YOURNAME>/xss-lock.sh &

There’s one more configuration here to make sure the screensaver comes up when the computer falls asleep, but I can’t seem to remember what I did (sorry!). That one is fairly easy to find by searching though. I’m not even entirely sure it’s necessary with this particular configuration.

Screenshots:

I made a screenshot script that just uses scrot.

I added this to .config/i3/config:

bindsym Print exec /home/<YOURNAME>/.config/i3/screenshot.sh

Volume controls:

This works in conjunction with the i3blocklet up above, and is ever so slightly different than what you’ll probably find while searching the web:

# Pulse Audio controls. Sends signal 1 to i3blocks
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% && pkill -RTMIN+1 i3blocks #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% && pkill -RTMIN+1 i3blocks #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle && pkill -RTMIN+1 i3blocks # mute sound

The main difference is that it sends signal 1 to i3blocks which allows the volume control blocklet to update only when the volume changes, instead of constantly polling for changes.

Screen brightness

This one was a bit of a challenge because Librem laptops work differently than most of the examples I found on the web. So, first, you need /sys/class/backlight/intel_backlight/brightness to be readable and writable by you. I used sudo chown $(whoami) /sys/class/backlight/intel_backlight/brightness, but I’m not sure if that’s the best way to go about it.

Then I added this into ~/.config/i3/config:

# Sreen brightness controls. Sends signal 2 to i3blocks
bindsym XF86MonBrightnessUp exec /home/<YOURNAME>/.config/i3/brightness.sh --inc 20 && pkill -RTMIN+2 i3blocks # increase screen brightness
bindsym XF86MonBrightnessDown exec /home/<YOURNAME>/.config/i3/brightness.sh --dec 20 && pkill -RTMIN+2 i3blocks # decrease screen brightness

The brightness script is available in the gist (toward the top of this post).

Trackpad

i3wm doesn’t come with any of the normal trackpad features, like touch, and the scrolling is reversed. So, I had to make these changes in my synaptics configuration (should be in /usr/share/X!!/xorg.conf.d):

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"

        # enable tapping
	Option "Tapping" "on"
	Option "TapButton1" "1"
        # right click with two fingers
	Option "TapButton2" "3"

        # natural scrolling
	Option "VertScrollDelta" "-75"
	Option "HorizScrollDelta" "-75"
EndSection

Conclusion

Anyway, I hope this was useful to someone. I’m by no means an expert (still very much learning), and kind of stumbled my way to this solution. I’m sure there’s someone here that can give better answers, and I encourage folks to contribute their knowledge here.


#2

I support the notion that the big DEs (Gnome, Plasma) are too… big. Or let’s say fat.
But my take is rather: They need to go on a diet.

I mean honestly… what can they do that I couldn’t do on my Windows 95 machine with 2MB of video memory and whopping 16MB of RAM? (Yes, MB as in MegaBytes)
16MB, because i was cooler than those who only had 8MB :wink:
Sure, we now have Unicode and transparency and stuff, but… It’s so bloated.
Btw, I could watch videos back then without lag. (Yes, they only had ~15 frames/s at 320x240 but still…

There is absolutely no connection between those. You can watch lag-less video with 1GB RAM and 1MB of free diskspace.
The most obvious things that might hit performance would be other processes eating CPU power. Even though I guess you could compile a kernel in the background without any frame drops.
Other things that can have an impact:

  • graphics driver
  • desktop backend (Xorg / Wayland / compositor)
  • player

Try different players, vlc for example. If the player is not well optimized, all the RAM and CPU in the world will not change it.
Now, if the video is in the browser, try a different one. Bad multimedia performance was the key factor why I switched from PureBrowser to Brave on PureOS.