Linux Platform Support
After focusing exclusively on Windows, the next logical step was to bring StayAwake to Linux. This meant rethinking core components while preserving the same minimal, transparent philosophy.
Cross-Platform Architecture
The build system was extended with Zig to support both Windows and Linux targets. Platform-specific code is guarded with
#ifdef blocks, allowing shared logic to remain in common files. The Taskfile was split into platform-specific variants
(Taskfile.windows.yml, Taskfile.linux.yml) while keeping a unified interface.
GTK3 Tray and D-Bus Integration
On Linux, the system tray uses GTK3 with AppIndicator (libayatana-appindicator). Power management communicates with the desktop environment via D-Bus, integrating with GNOME Session Manager and Mutter’s IdleMonitor for idle detection. Config file monitoring was initially implemented with inotify, but later replaced with GFileMonitor to improve Wayland compatibility and reduce platform-specific code.
Consistent Behavior Across Platforms
The tool now provides the same core functionality on both platforms: a tray icon with dynamic status display,
configurable idle timeout, and manual override via click shortcuts. PID file handling was moved to XDG_RUNTIME_DIR
with fallbacks, following Linux filesystem conventions.
Porting a Windows-centric tool to Linux reveals which design decisions are truly platform-agnostic versus those that are Windows-specific. The tray icon, config hot-reload, and power management all needed complete reimplementation, yet the underlying concept remained identical. This exercise validates the original design: a minimal, focused tool transcends its initial platform when the core idea is sound.





