The Tarkus Factory

Sway: The brief introduction to tiling window managers

Date : 2024-02-14

Summary: I can't lie to you that I've had some free time these days, which I've taken advantage of to learn about GNU/Linux Desktop. By installing it on two laptops, I've been able to learn about the kernel and the Ubuntu and Fedora operating systems. However, when I began my journey, I was playing in a safe environment like GNOME, this window manager that provides almost all the tools you need to start without having to tinker too much. But well, certain people say that you also learn about Linux when you have to use a tiling window manager (twm). So, this article is to tell you about how I've used a Mac M1, along with Fedora Asahi Remix, and installing Sway, a popular twm that allows you to create that fancy desktop that you can share on Reddit r/unixporn.

Let's go for the first rice!

tags: #Linux #FOSS


Table of Contents

  1. What is a twm? Why is it popular (in Linux)?
  2. Installing Sway and Configuring it.
  3. shortcuts shortcuts shortcuts!
  4. Is it all worth it?

It is said that there are two paradigms within the world of window managers: Stacking and Tiling. If you use Windows or MacOS, you may be familiar with the former, where basically the windows you operate for each running software can be overlapped, while the latter works on the avoidance of this (although it can be done) to take advantage of the space used by each program.

Despite this, the popularity of tiling window managers is mainly due to a niche, primarily the Linux community. You can check out the famous Reddit r/unixporn where people customize their operating systems to make them aesthetically and operationally tailored to their users. It's worth noting that this is not exclusively a characteristic of tiling window managers, but they do have a strong representation in that environment.

Finally, the reason why twms are interesting as software is that they are lightweight, highly customizable, and through the use of shortcuts, they can allow your workflow to be more efficient if you learn to use them.

Installing Sway and Configuring it.

When installing Asahi Linux on MacOS, I decided to install GNOME, which is a stacking window manager, and I was working normally within that ecosystem. Typically, this environment is quite user-friendly, with LibreOffice installed, Firefox, file management, etc.

Within this environment, I decided to install a tiling window manager (twm). Initially, I wanted to install i3, which is a very popular tiling window manager with more documentation and tutorials available. However, despite my attempts to install it, I ended up failing. This was probably because GNOME was mainly working in Wayland, which is a protocol server that the Asahi Linux ecosystem was based on, while i3 is based on the X11 protocol. For this reason, I had to switch to Sway, which is a twm based on Wayland. To install it, you simply open the terminal and type:

sudo dnf install sway

After entering that command in the terminal, you will install the window manager. Then, you close the session or reboot your system. When you need to log in again, go to the bottom right section and select Sway from the list of window managers to start the new environment. You should notice that the screen has nothing but a new wallpaper and a top bar. From there onwards, you'll need to go to your configuration file located at ~/.config/sway/config and add some configurations if needed. I personally made a few changes, for example:

  1. Adding layouts to switch between Spanish, English, and Japanese:

input type:keyboard {
    xkb_layout latam,us,jp
    xkb_options grp:alt_shift_toggle
  1. Tab style, where I remove borders, add gaps, and use a color adjusted to the gruvbox format for focused windows:

gaps inner 10
gaps outer 10

client.focused "#98971A" "#98971A" "#ffffff" "#98971A"
font pango:monospace 0
titlebar_padding 1
titlebar_border_thickness 0
  1. Set Audio and brightness shortcuts

#Set audio 
# Increase volume
bindsym $mod+F12 exec pactl set-sink-volume @DEFAULT_SINK@ +5%

# Decrease volume
bindsym $mod+F11 exec pactl set-sink-volume @DEFAULT_SINK@ -5%

# Mute/unmute
bindsym $mod+F10 exec pactl set-sink-mute @DEFAULT_SINK@ toggle

#Set Brightness
# F9 - Decrease brightness
bindsym $mod+F9 exec brightnessctl s 5%+

# F8 - Increase brightness
bindsym $mod+F8 exec brightnessctl s +5%-

This is generally some of the changes I made, trying to adjust it to my workflow, and it's been going quite well, to be honest.

shortcuts shortcuts shortcuts!

One of the strengths (and challenges) of working in a twm is that you quickly feel encouraged to use more shortcuts after realizing that you can open the terminal, the browser, send windows to other workspaces, and move between those workspaces. If you're using the Vimium extension in your browser and also use Vim for text editing, you may resonate with this way of working as it's quite consistent.

I get the impression that twms strongly encourage working in the terminal, so you may consider installing other software to work harmoniously in this environment. Some of the software I've been incorporating into this environment:

I hope to soon update a dotfiles with all this software.

Is it all worth it?

Short and obvious answer: it depends. If you're someone willing to invest the time to understand and configure your system, I'm sure it can accelerate your workflow process, and you might even enjoy working in this mode. I personally have enjoyed it, especially the way you can simply fly between different workspaces, making the experience incredibly satisfying. However, I've also had some annoying moments. For example, when you want to connect your devices via Bluetooth, you'll have to do it in the terminal, although you can open the settings within Sway if you're using GNOME or KDE Plasma, but otherwise you'll have to figure out how to do it in the terminal. Similarly, if you want to connect to Wi-Fi or take a screenshot, these small things that are so simple in general in other systems with a GUI can be a bit annoying to perform in the terminal or try to build your own shortcut in a config file. So, things that you had very well resolved before, you now have to rethink.

Likewise, if you're not someone who is really interested in delving into config files and prefers just navigating with your mouse within a GUI, then simply stick with GNOME or KDE or any other stacking window manager. Although I would still recommend installing a twm at least once to experience it.

CC BY-SA 4.0 Navi. Last modified: February 19, 2024. Website built with Franklin.jl and the Julia programming language.