Urgent.News

What's breaking now, across thousands of outlets.

Tech

A Tiny Linux Desktop Companion — and Wayland and GTK Kept Getting in the Way

The first version of Mochi was supposed to be simple... I wanted to draw a small character, put him on the desktop, let him walk around, react to clicks, and occasionally do something cute. Instead, I ended up debugging window coordinates across XWayland, fighting GTK popovers on multiple monitors, and learning that “just move the window” is not a complete desktop architecture. Mochi is a tiny…

Mochi is a tiny Linux desktop companion designed to walk around the screen, react to user actions, and provide ambient companionship. The project began with the inspiration of Codex Pets, aiming to create a charming character that exists alongside work on Linux. However, the development process quickly shifted as the author encountered challenges with window management, particularly with Wayland and GTK.

Initially, the author wanted Mochi to behave like a part of the desktop without constantly demanding attention. He aimed to make the character aware of the environment and react appropriately, such as sitting down with his own laptop when the user is typing or falling asleep when left alone. However, modern Linux desktops, particularly those using Wayland and GTK, present unique challenges for achieving this goal.

Wayland intentionally limits applications' control over global window positioning, making it difficult for Mochi to maintain his position and move freely across the screen. GTK adds another layer of abstraction, further complicating the development process. The author had to navigate between what he wanted Mochi to do, the capabilities offered by GTK, and the limitations imposed by GNOME and Wayland.

To overcome these challenges, the author decided to run the main Mochi window through XWayland, leveraging X11 APIs for precise root-window positioning. This approach allowed him to handle window management more effectively, but it introduced additional complexity, as Mochi had to deal with multiple coordinate systems, display scaling, and monitor configurations.

Throughout the development process, the author strove to create an ambient companion that would feel present without becoming intrusive. He aimed for Mochi to notice user actions and react sensitively, but avoid constant attention-seeking behavior. Despite the technical hurdles, the author remains committed to building a unique and engaging desktop experience that blends seamlessly with the Linux ecosystem.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Friday 11 September →