When Tiles Align: A stubborn Sway user tries COSMIC

ยทClayton Craft

After nearly 15 years of using lightweight tiling window managers (i3wm, then Sway), I've recently made a rather significant leap: I've switched to using the COSMIC desktop environment from System76. Even more unusual for me, I'm actually enjoying it. This post covers my experience packaging COSMIC for postmarketOS and my opinion after using it as my daily driver.

My Thinkpad x13s rockin' COSMIC on postmarketOS with systemd
My Thinkpad x13s rockin' COSMIC on postmarketOS with systemd

How did I end up here?

For the last several years, I've been using tiling window managers like Sway (and i3wm before that) as my daily driver. It's been a great experience overall, but over time I started noticing some parts were rather painful for me to deal with:

  1. Configuration fragmentation - I had to maintain many separate configuration files for different components (fnott, foot, waybar, gammastep, etc.) that I use to make Sway feel more, and there was no cohesion between them. Something as simple as toggling between light and dark themes meant modifying several config files across different applications, and some had to be restarted(!!) to apply the config. Let's just say there's a fairly high level of jank to get stuff mostly working, which brings me to...

  2. Integration issues - All of these additional components had to be discovered and "glued" together. Sometimes one of them would break and I'd have to rediscover how it was integrated with the rest of the stuff I am running. This meant spending more time maintaining my setup than I'd prefer.

While I was occasionally tempted by more integrated desktop environments, I struggled to give up on the perceived simplicity of using something like Sway.

I considered several desktop environments including GNOME, but found that most either lacked proper tiling support or had it bolted on in problematic ways. I also struggled with understanding how they were wired up internally, making debugging difficult. Many also lacked good options for easily managing and backing up configurations.

Enter COSMIC

When I heard about COSMIC, several things caught my attention:

  1. Tiling support - COSMIC supports all the tiling window manager features I want, including the ability to set keyboard shortcuts for any window management action. This let me keep my familiar key bindings from Sway. Importantly, COSMIC can run in "tiling mode" all the time (I've enabled this option, though the default is to use floating windows).

  2. Configuration done right - COSMIC can be configured through a graphical application, but all settings across the entire DE are stored as plain text files following proper FHS conventions. They are easy for users to find/understand/backup, and distros can easily ship their own defaults that users can override. Amazing!

  3. A chance to learn Rust - I've had several false starts with learning Rust, and using a DE written in Rust seemed like a perfect "unavoidable excuse" to finally dive in. ๐Ÿ˜…

Managing config is fun again!

It's important to me that any custom configuration I make on my systems can be backed up/restored easily, in case my laptop is lost or destroyed for example. One really nice feature of COSMIC is its elegant configuration system that seems to account for all components of the desktop environment. You can use the graphical Settings application OR directly edit config files - both work seamlessly. For example, to toggle dark mode for the entire DE:

echo -n true > ~/.config/cosmic/com.system76.CosmicTheme.Mode/v1/is_dark

Distros can ship defaults in /usr/share/cosmic/com.system76.CosmicTheme.Mode/v1/is_dark as an example, which users or system administrators can override. My custom configuration can be easily backed up (it's just text files), version-controlled with my dotfiles, immediately applied without needing to restart anything, and simple to understand and modify.

Packaging for postmarketOS

Getting COSMIC running on postmarketOS was relatively straightforward. Most components use Rust with just (a command runner tool similar to standalone make) to call cargo (the actual build system), though some presumably older parts use make directly. These were pretty easy to package in Alpine Linux.

I noticed many of the components seem to be lacking tests, which is a little concerning but understandable for alpha software. I'm hopeful tests will be added later, and perhaps I should try to contribute in this area!

The most challenging part? Waiting for all the Rust components to compile! There were some minor issues getting the greeter to start properly with systemd, but most of these have been resolved.

Alpine Linux's flexibility combined with pmbootstrap qemu for testing made the iterative development process much smoother than I expected. Being able to quickly test changes in a virtual environment was invaluable.

Performance? Zooom zooom

I haven't been rigorously measuring resource usage or performance, and comparing it to Sway. COSMIC is still in alpha development (I assume they're using semantic versioning), and I expect performance and memory usage will improve as it progresses toward release.

Realistically, a full desktop environment will probably never compete with a lean, mean Sway machine on resource usage. I'm willingly making that trade-off for the integrated experience and reduced configuration maintenance.

COSMIC quality and future

COSMIC is still alpha quality with some rough edges, so I don't broadly recommend it unless you understand what you're getting into. For example there's an open bug that seems to affect ARM stuff, that crashes the desktop (fortunately not very often for me.) I haven't tried to debug that one yet, but hope to soon. That said, it's been stable enough for my daily use. COSMIC is now available in postmarketOS edge, so it's easy to give it a try on your laptop, tablet, Steam Deck, phone, whatever!

As with any open source project controlled primarily by a single company (System76), there's reason for some cautious optimism. I hope they continue to be good stewards of COSMIC by keeping future development in the open and resist the temptation to add telemetry, AI features, or other fad additions that could compromise user privacy.

Help wanted!

I could use help finding and fixing integration issues in postmarketOS, specifically when using COSMIC with systemd. For example, there are still some challenges with components like the greeter and session management. If you're interested in contributing to this effort, please reach out on postmarketOS chat!

Final thoughts

For a long-time tiling window manager user, COSMIC represents a surprisingly comfortable middle ground. It preserves the keyboard-driven efficiency I've grown accustomed to while adding the benefits of an integrated desktop environment.

While it's not yet ready for everyone, I'm optimistic about where COSMIC is headed. If you've been considering a more integrated tiling environment but haven't found an acceptable alternative, COSMIC might be worth keeping an eye on. I'll definitely keep trying it out for the foreseeable future ๐Ÿ˜

I want to thank fossdd, JustSoup, Sertonix, and WhyNotHugo for their helpful packaging-related reviews and feedback. Their contributions made this porting effort much smoother than it would have been otherwise.