Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround for broken or missing tray icon menu on linux #1287

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

JarEXE
Copy link
Contributor

@JarEXE JarEXE commented Dec 11, 2024

When submitting this pull request, I confirm the following (please check the boxes):

  • I have read and understood the Contributor Guidelines.
  • I have checked that there are no duplicate pull requests related to this request.
  • I accept that this submission may not be used and the pull request may be closed at the discretion of the maintainers.
  • I have considered, and confirm that this submission is valuable to others.

Fill in the PR content:

Hydra's tray icon has been broken for quite some time on Linux. When right clicking, either a blank menu is displayed, or nothing at all. I have experienced this issue on various desktop environments such as Cinnamon, Gnome, and XFCE. This is probably more of an issue with Electron itself.

This is a workaround that is meant to set the context menu on initial app load, so that Linux users will at least be able to do something with the tray icon. For example, they can now safely "Quit" the app from the tray menu if they have the "Don't hide Hydra when closing" behavior option unchecked. Without this workaround, Linux users either have to keep that option checked to remove the "hide" feature or kill the app from the CLI or their "process manager" if they left it unchecked.

Explaining why this is likely an Electron issue:
According to the Electron docs - https://www.electronjs.org/docs/latest/api/tray

The right-click instance event is only supported on macOS and Windows. This event listener is being set in Hydra along with the regular click event, but it does absolutely nothing on Linux. The event never gets registered, therefore showContextMenu never runs.

The popUpContextMenu method is only supported on macOS and Windows. This is what Hydra is using in the showContextMenu function. It does absolutely nothing on Linux.

@JarEXE
Copy link
Contributor Author

JarEXE commented Dec 11, 2024

Before workaround
hydra_actual

After workaround
hydra_tray_expected-2024-12-11_13 16 15

@zamitto
Copy link
Collaborator

zamitto commented Dec 11, 2024

This probably even remove the need to set to "right-click" for other platforms.
We will test this idea in Windows/Mac when possible
Thanks a lot

@zamitto zamitto merged commit 95d320a into hydralauncher:main Dec 11, 2024
4 checks passed
@JarEXE
Copy link
Contributor Author

JarEXE commented Dec 11, 2024

Thanks a lot

@zamitto No problem at all 🙂

This probably even remove the need to set to "right-click" for other platforms.

I would be a bit cautious with removing "right-click" for the other platforms. The "right-click" is calling showContextMenu which is in turn calling updateSystemTray.

I notice that updateSystemTray has a nice feature where it adjusts the "most recently played" games in the context menu before it is displayed.

This is nice for macOS and Windows users, they can at least have their most recently played games updated in the menu every time they right click.

But for the Linux users, they will just have to be satisfied with the workaround until someone else knows a better way to update the "most recently played" games every time or until Electron has better Linux support.

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