The Story behind the Sway profile for Manjaro ARM2020-07-20
In this blog post I want to highlight some of the experiences I've made while working on the Sway profile for the Manjaro ARM installer. The reasons for me to start afresh with Linux on an ARM64 based architecture has been laid out in my introductory post. My experiences with the Pinebook Pro device itself and the reason to go with Manjaro ARM have been outlined in my last post. This time I will talk about the Sway window manager, how I created an installer profile for the Manjaro ARM builds, and how it ended up in the official Manjaro ARM repository.
When going to the Manjaro download portal you will find two official versions - one based on the KDE desktop environment and another one based on the XFCE desktop, as well as a community supported variant based on the i3 window manager. Whereas both the KDE and XFCE desktop environment take up the commonly known desktop metaphor made popular by the original Classic Mac OS and Windows operating system back in the 1980s, the i3 window manager uses another (I dare to say fresh) approach to the graphical user interface known as tiling window management.
The common desktop metaphor is funded on the following principles:
- the screen is a virtual instance of a desk, on which the user can freely arrange (application) icons and windows
- the desktop hosts an application bar, which can be used to start programs or show status information to the user
- each application is displayed in its own window, which takes up a certain area of the desktop and can be moved around and resized with no constraints
- application windows can freely overlap with each other
- a desktop can span multiple screens
- the desktop environment consist of a selection of tools working closely together to provide a consistent user experience (e.g. window manager, application launcher, statusbar, notifications, ...)
- multiple instances of a desktop (aka workspaces) can be used to group related application windows
- the main input device to interact with the desktop is the mouse
- the work is organized in multiple workspaces by default
- each workspace can host one or more containers
- application content will be displayed in those containers, which can be organized on a workspace via horizontal or vertical splits
- workspaces can be freely arranged on the available screens
- the window manager is solely handling the organization of content on the screens, additional tools have to be chosen for statusbar, application launcher, notifications, ...
- the main input device to interact with the window manager is the keyboard
As such a tiling window manager is more lightweight, easily customizable and focussed on user productivity when compared to the traditional desktop environments.
So after deciding to go with a tiling window manager the only question left was using either i3 or Sway. As the Manjaro ARM community already provided an i3 image for the Pinebook Pro I surely looked into this option first by putting it onto a microSD card. It turned out that the i3 image have had some serious issues back then. When diving a little deeper into the problems I figured that some of them may be related to the already aged X11 display server and its overly complex architecture, which dated back to a time when the computers on a users desk were just dump terminals that are always connected to a big server doing most of the rendering tasks in the background. A replacement for it has been in the works for a couple of years already in the form of the Wayland display server protocol, which also should remove the various flaws and security issues that have been identified in X11 over the years.
As such Wayland is a more lightweight display server protocol, which removes a lot of the bloat of the X11 server and is more suitable for mobile devices by design. A couple of distributions are using it as the default already - among them Fedora, CentOS as well as Debian 10 if using the default GNOME desktop session.
So I was looking for a way to get myself a Manjaro ARM installation that is based on Wayland and Sway. I've already noticed in the forums that the Manjaro ARM team is providing an installer script that can be used to create custom images for desktop environments not provided by the core team. Following their README it was clear how this is supposed work: you can run the script from your Pinebook Pro and flash the image to the microSD (when booted from eMMC), or to the eMMC (when booted from microSD).
First it shows a selection of supported ARM64 devices (note: there is no support for 32-bit ARM architectures on Manjaro any longer):
On the second screen it asked for the edition to be used (remark: Sway has been added at a later point in time and was originally not part of it):
Searching a little further I came across a separate Git repository that hosts the support files for this installer, so it knows about the devices, editions and as such packages it is going to install. As I haven't had write-access to this repository in the beginning I started to clone it together with the Manjaro ARM installer as I have had to change the Git repository URL that the script refers to as well. The layout of the Manjaro ARM Profiles repository is quite straight forward:
. ├── devices ├── editions ├── overlays └── services
devices folder contains a file for each supported ARM64 device, which list the device specific packages such as kernel, drivers, firmware and boot configuration. I didn't expected any updates to this section for the Sway profile. That said in theory the Sway profile should also work on all the other supported ARM64 devices, but at the moment I'm only providing ready-made and community-tested images for the original Pinebook and the Pinebook Pro.
editions folder holds a file for each available edition. Those files contain all the required packages for this specific edition to work. As expected I have added a new file for the Sway profile here and added all the packages I found necessary for a good end-to-end user experience in Sway.
editions/ ├── ... ├── i3 ├── kde-plasma ├── minimal ├── ... ├── sway ├── ... └── xfce
overlays folder contains edition specific configuration files that will be moved in place after the packages have been installed. Those files offer both default configuration for the system (
/etc) as well as for the users (
/etc/skel). They are used for topics such as theming, system-wide environment variables, autostart applications, as well as custom scripts and files to be copied to the
/usr folder in the image.
overlays/sway/ ├── etc │ ├── environment │ ├── greetd │ ├── hosts │ ├── NetworkManager │ ├── pamac.conf │ ├── profile.d │ ├── pulse │ ├── skel │ ├── sway │ ├── systemd │ ├── wlogout │ └── xdg ├── overlay.txt └── usr ├── local └── share
Last but not least the
services folder holds an edition specific file that contains all the systemd services to be enabled out-of-the-box after the installation is done, which should include among others the network manager, login manager, power management daemon as well as zram swap service.
Something I stumbled upon very early in my experiments with Wayland and Sway is the situation that Wayland is just a display server protocol, and Sway a window compositor implementing it. As stated above you will have to find additional tools and applications to provide a good end-to-end user experience that is on par with other desktop environments when using tiling window managers. Some of these software packages are still evolving, or have to be written at all, but here are the important pieces I came up with after searching around the forums and Github:
- Logon Manager: greetd and gtkgreetd
- Notifications: mako
- Statusbar: Waybar
- Application Launcher: bemenu and wofi
- Terminal: termite
- Shutdown Menu: wlogout
These are only the fundamental parts to be able to offer some kind of desktop experience, there are others that you will also need - e.g. to capture or record your screen, arrange your external displays, copy-paste, ... a list of potential candidates can be found here.
In addition to these challenges I faced an additional problem: most of those wayland-oriented software packages haven't made it to the official Arch Linux repositories yet, and could only be installed via AUR scripts. But this turned out to be a roadblocker as the Manjaro ARM Installer script can only install prebuild packages from the existing repositories. So a member from the Manjaro ARM team proposed to me the idea to create a custom package repository with those addons and adapt the installer script in a way that it registers this repository before installing the packages. This was giving me some headaches in the beginning, but after some trial-n-error I was finally able to serve those packages and created a first version of my Sway image. I placed this onto a microSD card, started the video cam on my smartphone and fired up the Pinebook Pro. The result was happily shared on Twitter that day:
Happy to announce that the first release of my custom #swaywm image for the #PinebookPro based on @ManjaroLinuxARM is ready to be released. Look for an upcoming blog post about it here: https://t.co/48sE0ytPnl pic.twitter.com/adUQaMGKDx— Andreas Gerlach (@appelgriebsch) June 16, 2020
If that would be the end of this story, this blog post would have been published weeks ago. As it turned out the video was perceived very positive from a wide range of Linux users, and I was asked by the Manjaro ARM team lead if I would be ready to merge my changes back to the official repository and support the Sway profile in the Manjaro ARM repositories going forward. Which I happily agreed and started working on an official version of the Sway profile, which also includes the adoption to the look-and-feel and branding of the Manjaro Linux user interface.
Meanwhile the Manjaro ARM team opted to add the fundamental software packages I have chosen for the desktop experience to their build infrastructure, which would allow the Manjaro ARM Installer script to grab them from an official repository. Within 2 days of rapid iterations on the installer script, additional package requirements and the Sway profile we were able to showcase a new version of the image, which was build from the official sources and uses the Manjaro Linux look-and-feel...
Well… that was perceived far better and wider than I’ve expected and I’m proud to say that the #swaywm profile is part of the original @ManjaroLinuxARM repositories now, incl. all the additional packages and branding. Thank you all! here’s a little teaser https://t.co/027pkpmgao pic.twitter.com/PoFhA3Zp9L— Andreas Gerlach (@appelgriebsch) June 18, 2020
We still didn't stop here. The current approach requires the user to work with scripts meant for hackers and tinkerers of the Manjaro ARM Linux system. The usual way of downloading a ready-made image file, extract and restore it to either a microSD or the eMMC was just not possible as there were no ready-made images for the Sway profile. This seems to be a blocker for some people on the forums, so I was in discussion with the Manjaro ARM core team how I could create and provide these image files. It turned out they have already been working on tools that would allow this, but those haven't been made it through the various stages yet. Skip forward to the end of June 2020, when a stable update provided the missing pieces (namely the manjaro-arm-tools package) as part of the official stable repositories. Immediately I started creating an image file for the Sway profile, which can be done via a single command such as this:
sudo buildarmimg -d pbpro -e sway -v 20.06 -b arm-stable
This really improved the situation for volunteers, who just want to download the image and try it out on their system, so I got a lot of feedback and suggestions in the forums. Those have been taken up and addressed in subsequent image versions, which I put together regularly and upload them to an OSDN file storage. There are two locations being used at the moment:
- versions released along the official Manjaro ARM images in a 2-monthly release cycle are available here, and follow the same community-supported approach as the i3 image does
- pre-release versions that I made in between to validate new features or settings can be downloaded here
I must say I'm very glad how this has turned out in the end. I didn't even expected that my changes and work will become part of the official Manjaro ARM repositories when I was starting with it. It was driven by an internal desire and need to get a working Sway installation on my Pinebook Pro. There has been some challenges and pitfalls along the way, which sometimes weren't that easy to solve and really required me to go down the rabbit hole, but at the end I'm quite satisfied with the results so far. Needless to say that the most important work to make this even possible wasn't done by myself, but rather by the various FOSS projects that I could just refer (and also give back) to. This also gave me a first hands-on experience of the community work around Linux and Manjaro ARM in particular, and has strengthen my positive feeling of the tremendous efforts and open and friendly attitudes in those communities.
For those more curious how the Sway profile works and what it has to offer I will add a short walkthrough here. More detailed information to the available keyboard combos can be found in the
README.md file, which is part of the profile overlay and should be placed into the users home directory after installing the image.
The default configuration for Sway can be found in
This directory hosts various configuration files of which the important ones are:
/etc/sway/definitions: host the global definitions such as the application launcher, terminal, the idle program, default and alternative modifier key, ...
/etc/sway/config: the default Sway configuration file. If you want to customize it, you should create a copy in
$HOME/.config/swayand change it as needed.
/etc/sway/config.d/99-autostart-applications: contains all the programs that has to be started as soon as the Sway session initializes
/etc/sway/themes/matcha: the color configuration to match the matcha theme of Manjaro
The default modifier key ($mod) is the Alt key.
Additionally, there are two kind of movement key sets:
- VIM mode: h / j / k / l
- Arrows: left / down / up / right
Sway has up to ten different workspaces that can be freely arranged on the available displays.
Opening / Closing Applications
- open a new terminal window: $mod + Enter
- open the application launcher: $mod + d
- open the run command: $mod + Shift + d
- kill the application (forcefully): $mod + Shift + q
- switch to another workspace: $mod + 0-9 (workspace no.)
- move an application to another workspace : $mod + Shift + 0-9 (workspace no.)
- focus another application window: $mod + <movement-key>
- move the focused application window around on the current workspace: $mod + Shift + <movement-key>
Changing the Container Layout
- toggle between horizontal and vertical layout: $mod + e
- enable stacking of application windows: $mod + s
- enable tabbed application windows: $mod + w
Restart / Exit
- reload Sway configuration: $mod + Shift + c
- exit Sway session: $mod + Shift + e
The statusbar on top shows all active and inactive workspaces to the left as well as some system information such as network status, cpu and memory consumption level, battery status, display brightness, audio volume level, and the system tray area on the right. In the tray area you will find your system update status as well as network and bluetooth connectivity applets.
The default configuration for the statusbar can be found in
/etc/xdg/waybar, and as usual you can customize it by placing a tailored one in
The next stable version of the Sway profile will be released together with the other official Manjaro ARM images in the 20.08 iteration beginning of August 2020.
This version will include a custom bash script in
install_chromium_widevine.sh, which when executed will create a custom systemd-nspawn container in
/var/lib/machines/chromium_widevine based on a 32-bit armhf version of Debian 10 Buster. Additionally, a compatible Chromium browser incl. the required DRM extensions are installed into this container. This will take some time, but when finished you are able to launch a custom Chromium-Widevine application either via the application launcher (
Chromium-Widevine), or via the shell (
launch_chromium_widevine.sh). This application will allow you to consume DRM protected media content on the Internet from sites such as Netflix, Amazon Prime Video or even Spotify on your Pinebook Pro.
If you want to try out the Sway image feel free to head over to the download URLs given above. For feedback and suggestions please head over to the Manjaro ARM forum and open a topic here, or add your comment to the existing Sway Profile discussion.