Skip to content

Linux version - #10

Draft
billg-splunk wants to merge 6 commits into
splunk:mainfrom
billg-splunk:main
Draft

Linux version#10
billg-splunk wants to merge 6 commits into
splunk:mainfrom
billg-splunk:main

Conversation

@billg-splunk

Copy link
Copy Markdown

It works for me, more or less. The toolbar submenus give me a little trouble in kde. I have not tested gnome.

I would suggest having at least 1 or 2 testers before merging.

billg-splunk and others added 2 commits July 28, 2026 16:52
Resolve README, CONTRIBUTING, and install script conflicts while keeping Linux systemd support and matching install-systemd-user to the server-only/menubar-only split used on macOS.

Co-authored-by: Cursor <cursoragent@cursor.com>
@billg-splunk

Copy link
Copy Markdown
Author

@bhavsarpratik I think I have successfully merged things, but it would be good to have a review from someone with a Mac.

@billg-splunk
billg-splunk marked this pull request as draft July 31, 2026 22:04
@bhavsarpratik

Copy link
Copy Markdown
Member

Thanks @billg-splunk, I tested the installation on my mac and it works without issues. Unfortunately I do not know anyone who uses Linux. Can you check with a friend and get the Linux installation and menubar confirmed?

Sharing the review from my Codex


Thanks for putting this together. Reusing the existing Python server and /menubar payload for Linux is the right direction. I’d like a few changes before merging so Linux support remains maintainable and doesn’t make the macOS/Linux paths harder to understand.

Issues to fix

  1. The Linux dependency check always succeeds

    In menubar/token_meter_tray.py, --check exits successfully before checking GTK_AVAILABLE. Therefore, scripts/install can report that dependencies are valid even when GTK, PyGObject, or AppIndicator is missing.

    Please make --check fail with the existing requirements message when the imports are unavailable. It should also check or explicitly document xdg-open and notify-send; currently notifications silently disappear if notify-send is missing.

  2. Polling blocks the GTK UI thread

    GLib.timeout_add_seconds(2, self.poll) calls urlopen(..., timeout=5) synchronously. A slow or restarting server can freeze the tray and its submenus for up to five seconds every poll.

    Please perform HTTP polling in a worker thread or asynchronously, then apply the result through GLib.idle_add.

  3. Separate platform-specific installation logic

    scripts/install now contains both macOS and Linux service logic. It also requires macOS files on Linux and copies both platforms’ companion files into every runtime.

    I suggest keeping scripts/install as a small dispatcher and moving implementation into clearly named scripts such as:

    scripts/install-macos
    scripts/install-linux
    scripts/install-macos-launch-agents
    scripts/uninstall-macos-launch-agents
    scripts/install-linux-systemd-user
    scripts/uninstall-linux-systemd-user
    scripts/run-desktop-companion
    
  4. Use platform-neutral directories and clearer filenames

    A Linux tray implementation under menubar/ and a dispatcher named run-menubar make the repository increasingly macOS-centric.

    Suggested structure:

    desktop/
      macos/TokenMeterMenuBar.swift
      linux/tray.py
      linux/presentation.py
      linux/state_store.py
    

    The new Linux tray is 1,268 lines. Splitting GTK widgets, state persistence, formatting, and notification logic now will make it much easier to test and prevent drift from the macOS implementation.

  5. Centralize OS-specific paths

    meter.py currently uses IS_LINUX, with every non-Linux system implicitly receiving macOS paths. Please introduce an explicit platform/path abstraction—for example, platform_paths.py with macOS, Linux, and unsupported-platform handling. This gives us one place for Claude, Cursor, Trash, runtime, and configuration paths and avoids Windows accidentally receiving macOS defaults.

  6. Add real Linux validation

    The new installer tests mostly assert that strings exist in source files, while the actual Linux path test is skipped on macOS. There is also no CI workflow.

    Before merging, I recommend:

    • A Linux CI job that executes the Python tests and Linux path tests.
    • A behavioral test proving --check fails without GTK/AppIndicator.
    • Tests for generated systemd units, ideally using systemd-analyze verify.
    • Manual confirmation on both KDE and GNOME, including install, login autostart, tray menus, notifications, update, and uninstall.
    • Screenshots or a short validation note from the testers.
  7. Reconsider tray autostart

    The tray unit is enabled under default.target, even though it requires a graphical session. That can start it in headless user sessions without guaranteeing the desktop/DBus environment is available. Consider using an XDG autostart .desktop entry for the tray and retaining systemd --user for the server. If systemd is retained for both, it should be tied and ordered correctly against the graphical session.

Small cleanup

  • git diff --check currently fails because of trailing whitespace in scripts/install.
  • README still says deleted logs go to “macOS Trash” even though Linux is now supported.
  • Use “desktop companion” generically, and reserve “menu bar” for macOS and “tray” for Linux.
  • Keep /menubar as a compatibility API if needed, but use platform-neutral names for new internal code.

Validation at PR head 34b1063: 235 tests ran with one Linux-specific test skipped; Python compilation, JavaScript parsing, and shell syntax passed. git diff --check failed on the whitespace noted above.

Overall, the feature direction looks good, but I would request changes before merging—especially the false dependency check, synchronous GTK polling, platform organization, and missing Linux behavioral validation.

@billg-splunk

Copy link
Copy Markdown
Author

@bhavsarpratik I haven't implemented all these recommendations yet but the one that made the most sense was to pull the linux install into a separate file. The only concern is that any changes to install need to also update the other install scripts consistently.

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.

2 participants