Skip to content

Add baseline Linux support so exactobar can run outside macOS - #1

Open
diegonix wants to merge 3 commits into
fed-stew:mainfrom
diegonix:feat/basic_linux_support
Open

diegonix wants to merge 3 commits into
fed-stew:mainfrom
diegonix:feat/basic_linux_support

Conversation

@diegonix

Copy link
Copy Markdown

Motivation

Add baseline Linux support so exactobar can run outside macOS, with a native tray integration and CI coverage to keep it stable across platforms.

Architecture / Approach

  • Implemented Linux tray integration using StatusNotifierItem (SNI).
  • Ensured GPUI app builds on Linux, leveraging GPUI’s cross‑platform behavior.
  • Added multi‑platform CI to build on macOS and Linux.
  • Refactored code for cross‑platform compatibility and improved structure.
  • Updated documentation to reflect new platform support and modules.

Affected Components

  • Tray integration: Linux SNI implementation.
  • GPUI app build: cross‑platform build adjustments.
  • CI pipeline: GitHub Actions multi‑platform matrix.
  • Docs: core, fetch, and providers modules.
  • Core/refactors: cross‑platform compatibility changes.

Compatibility / Testing

  • CI: Builds on macOS and Linux.
  • Manual: Linux tray behavior verified via SNI integration (as implemented).

## Motivation
The application previously only supported macOS for system tray functionality. Linux users need equivalent tray integration to access menu options and receive status updates from the system tray area.

## Architecture / Approach
Implements Linux tray support using the ksni crate which communicates via the StatusNotifierItem DBus protocol. Adds a new LinuxTray struct that implements the ksni::Tray trait, handling icon rendering, click events, and context menu actions. The implementation is fully conditionally compiled behind target_os = "linux" to maintain platform separation. Icon rendering converts RGBA pixel data to ARGB format expected by the Linux notification system.

## Affected Components
- exactobar-app/src/tray.rs: Added LinuxTray struct, LinuxTrayEvent enum, and platform-specific SystemTray methods
- exactobar-app/Cargo.toml: Added ksni dependency with blocking and async-io features for Linux target
- exactobar-app/src/menu.rs: Added conditional background for Linux (opaque instead of blur)
- exactobar-app/src/theme.rs: Added window_background() function for platforms without blur support

## Compatibility / Testing
Adds platform-specific code that only compiles on Linux. The stub implementation for non-macOS/Linux platforms is preserved. Requires testing on Linux distributions with StatusNotifierItem support (GNOME, KDE, etc.).
## Motivation
Improved code documentation is essential for maintainability, API consumer understanding, and automated documentation generation. Many enums, structs, constants, and functions lacked descriptive doc comments.

## Architecture / Approach
Systematically added doc comments to enum variants, struct fields, public constants, and public functions throughout the codebase. The documentation follows Rust conventions, using /// for item documentation and /// for field-level documentation within enum and struct definitions. Error types received enhanced field documentation to improve error handling clarity.

## Affected Components
- exactobar-core/src/models/provider.rs: IconStyle enum variants
- exactobar-fetch/src/error.rs: All error enum field documentation (KeychainError, ProcessError, PtyError, BrowserError)
- exactobar-fetch/src/host/keychain.rs: Service names and account names constants
- exactobar-fetch/src/host/browser.rs: Browser enum variants
- exactobar-fetch/src/host/process.rs: CLI command constants
- exactobar-fetch/src/host/status.rs: Status page URL constants
- All provider descriptor and strategy modules: Added documentation to public structs and functions

## Compatibility / Testing
No functional code changes. Only documentation additions that improve IDE tooltips and rustdoc output.
## Motivation
The macOS-only architecture caused compilation issues on other platforms due to unused code warnings. Additionally, some code style improvements were needed for future multi-platform support.

## Architecture / Approach
Added cfg_attr allow(dead_code) directives to modules that are only used on macOS to suppress warnings on other platforms. This maintains a single codebase targeting multiple platforms. Fixed spawn closure parameter naming from mut cx to cx for consistency with asynchronous callback patterns where mutable access is not needed.

## Affected Components
- exactobar-app/src/actions.rs: Fixed spawn closure parameter, added dead_code allowance
- exactobar-app/src/components/mod.rs: Added dead_code allowances for unused UI components on non-macOS
- exactobar-app/src/icon.rs: Added dead_code allowance for macOS-specific icon rendering
- exactobar-app/src/state.rs: Fixed spawn closure parameter, added dead_code allowance
- exactobar-app/src/menu.rs: Fixed spawn closure parameter, added Linux background styling
- exactobar-app/src/theme.rs: Added window_background() for non-blur platforms
- exactobar-store/src/settings_store.rs: Added LogLevel variant documentation
- exactobar-store/src/usage_store.rs: Added CostUsageSnapshot and DailyCost field documentation

## Compatibility / Testing
No functional changes on macOS. Enables successful compilation on Linux by properly handling platform-specific code. All existing functionality is preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant