Skip to content

feat: native tray context menu for Linux#36

Open
fyiel wants to merge 1 commit into
UnionCrax-Team:mainfrom
fyiel:feature/linux-tray-context-menu
Open

feat: native tray context menu for Linux#36
fyiel wants to merge 1 commit into
UnionCrax-Team:mainfrom
fyiel:feature/linux-tray-context-menu

Conversation

@fyiel

@fyiel fyiel commented Jun 29, 2026

Copy link
Copy Markdown

Adds a native system-tray context menu on Linux, so right-clicking the tray icon shows actionable buttons

Because: the tray uses tray.on('right-click'/'click') to open a custom popup, but on Linux those events are never delivered by the StatusNotifierItem/libappindicator tray, so the Linux tray icon had no menu at all. A native menu via tray.setContextMenu() is the only reliable way to make it interactive

Changes are additive and all in electron/main.cjs. There's a new buildTrayContextMenu() that builds the menu with Open, Browse, Library, Downloads, Settings, a "Stop " entry that only shows while a game is running, and Quit. createTray() attaches it with setContextMenu() on Linux only, and refreshTrayMenu() rebuilds it whenever a game starts or stops so the "Stop " line stays accurate. The existing tray popup and its IPC action handler are left untouched, and Windows and macOS keep their styled right-click popup.

Tested on Hyprland/Wayland with waybar + libayatana-appindicator3: icon shows, right-click opens the menu, actions work

No new dependencies

Contact: Discord 318912487162511370 (fywni#0)

- Linux trays (StatusNotifierItem/libappindicator) don't deliver click/right-click events to Electron, so the styled tray popup never opened on Linux (the icon had no menu at all)
- Add a native context menu via tray.setContextMenu() on Linux: Open / Browse / Library / Downloads / Settings / Stop <game> / Quit
- Rebuild the menu on game start/stop so "Stop <game>" stays accurate
- Kept additive so the existing tray popup and its IPC handler are untouched
- Windows/macOS unchanged (they keep the styled right-click popup)
@fyiel fyiel force-pushed the feature/linux-tray-context-menu branch from 1a7b099 to b2389bf Compare June 29, 2026 08:18
@fyiel

fyiel commented Jun 29, 2026

Copy link
Copy Markdown
Author

wiped first commit cause i was rewriting the tray-popup:action handler, pr is now purely additive so there shouldn't be any issues.

I may also be wrong about

but on Linux those events are never delivered by the StatusNotifierItem/libappindicator tray
and it may be that my installation is missing packages to make this type of thing work, but i couldn't figure out if that was true or not, so..

this was tested locally on Arch with Hyprland and waybar as the StatusNotifierItem host

tested for: v0.55.4 hyprland, v0.15.0 waybar, v0.6.0 libayatana-appindicator, v0.9.5 libayatana-indicator, v3.24.52 gtk3, v33.4.11 electron

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