Skip to content

feat(tray): Add Linux/Wayland support#273

Closed
benwyrosdick wants to merge 11 commits intorobinebers:mainfrom
benwyrosdick:waybar-support
Closed

feat(tray): Add Linux/Wayland support#273
benwyrosdick wants to merge 11 commits intorobinebers:mainfrom
benwyrosdick:waybar-support

Conversation

@benwyrosdick
Copy link

@benwyrosdick benwyrosdick commented Mar 6, 2026

Description

Adds support for Linux/Wayland on Waybar

Related Issue

Related to #77 but focused on Linux and not Windows

Type of Change

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass
  • I tested the change locally with bun tauri dev (tauri not available on linux)

Screenshots

image

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

Summary by cubic

Add native Waybar support on Linux/Wayland via a new CLI, extract the plugin engine into its own crate, and add Linux keychain support so plugins can store and read secrets.

  • New Features

    • New openusage-waybar binary that outputs Waybar JSON; module text shows remaining %, and percentage reports remaining.
    • Tooltip with colored bars, remaining amounts, reset times, and Pango‑escaped strings.
    • Primary progress respects the plugin manifest’s primaryOrder; falls back to the first progress line.
    • Plugin discovery from standard dirs and OPENUSAGE_PLUGINS_DIR; supports --list, --json, and selecting plugins by ID.
    • README adds Linux/Waybar install guide with config example, env vars table, and a screenshot.
  • Refactors

    • Plugin engine moved to openusage-plugin-engine crate and reused by the Tauri app.
    • Keychain host API is cross‑platform; adds Linux read/write using secret-tool (libsecret).
    • Cargo workspace introduced; Cargo.lock added and .gitignore updated for /target.
    • Progress bar builder now takes an explicit remaining percentage for clearer rendering.

Written for commit e1ac2e5. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 6, 2026 17:49
@github-actions github-actions bot added the rust Pull requests that update rust code label Mar 6, 2026
@benwyrosdick benwyrosdick changed the title Waybar support feat(tray): Add Linux/Wayland support Mar 6, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 14 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/openusage-waybar/src/main.rs">

<violation number="1" location="crates/openusage-waybar/src/main.rs:176">
P2: Plugin-controlled strings are inserted into Pango tooltip markup without escaping, enabling broken rendering or markup injection in Waybar tooltips.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Linux/Wayland (Waybar) support by introducing a standalone Waybar CLI that runs the existing plugin system, and by extracting the plugin engine into a reusable Rust crate that both the Tauri app and CLI can consume.

Changes:

  • Extract plugin engine into crates/openusage-plugin-engine and wire src-tauri to use it as a dependency.
  • Add openusage-waybar binary crate that runs plugins and outputs Waybar-compatible JSON (with Pango tooltips).
  • Add a root Cargo workspace and document Waybar installation/configuration in the README.

Reviewed changes

Copilot reviewed 9 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src-tauri/src/lib.rs Switches from an internal module to the shared openusage-plugin-engine crate.
src-tauri/Cargo.toml Adds a path dependency on the extracted plugin engine crate.
crates/openusage-waybar/src/main.rs New Waybar CLI: plugin discovery, execution, and Waybar JSON formatting.
crates/openusage-waybar/Cargo.toml Declares the new openusage-waybar binary crate and dependencies.
crates/openusage-plugin-engine/src/runtime.rs Updates imports to match the new crate module layout.
crates/openusage-plugin-engine/src/manifest.rs New manifest/plugin loader and link sanitization; loads entry script + icon.
crates/openusage-plugin-engine/src/lib.rs Exposes plugin engine modules and adds load_plugins_from_dir for CLIs.
crates/openusage-plugin-engine/src/host_api.rs New host API implementation (env/fs/http/sqlite/ls/ccusage/etc).
crates/openusage-plugin-engine/Cargo.toml Declares the new plugin engine crate and its dependencies.
README.md Adds Waybar installation/config instructions and adjusts download section.
Cargo.toml Introduces a root workspace with src-tauri + new crates.
.gitignore Ignores Cargo /target/ build artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

benwyrosdick and others added 4 commits March 6, 2026 12:24
… to use new platform-specific helper functions for macOS and Linux.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@benwyrosdick
Copy link
Author

Re: markup escaping feedback — fixed in 7412aa1. Added pango_escape() for all plugin-controlled strings before markup interpolation.

@robinebers
Copy link
Owner

Love it but without looking into this or major support, a 7.7k diff PR is incredibly hard to review and keep updated.

I think we'll make the decision to only support macOS to keep things simple, and hope that people will maintain a Linux/Windows port on their own.

Thanks though!

@robinebers robinebers closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants