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

Add Support for the System Tray #104

Open
wants to merge 6 commits into
base: next
Choose a base branch
from

Conversation

N0tACyb0rg
Copy link
Contributor

Closes #91
Adds support for a bare-bones system tray implementation using PyQt6 (I know, Qt in a GTK project...). The current functionality allows the user to left-click the tray icon to toggle the main window visibility. The menu presented by the tray doesn't work quite yet, but that'll be included with config options and changing the main window close behavior.

@N0tACyb0rg
Copy link
Contributor Author

The main window now goes into background mode when the close button is pressed, and the "Quit Varia" button in the tray context menu now works as intended.

@N0tACyb0rg N0tACyb0rg force-pushed the trayicon branch 2 times, most recently from b7243a3 to a5cccfb Compare May 11, 2024 17:48
@N0tACyb0rg
Copy link
Contributor Author

This should now be ready for merging, as I added the relevant configuration option in the preferences, and made PyQt6 an optional dependency since it is a whole other framework that needs to be installed.

N0tACyb0rg and others added 4 commits September 7, 2024 21:18
Hello. First of all, thanks again for your contributions, I have been quite busy with many other things so I ended up ghosting many PRs. I have no problem with adding Qt dependencies to a GTK based project in principle but it causes problems with the Flatpak distribution system, mainly because we can't use multiple runtimes and sdks at once. This means we have to compile all required Qt dependencies from scratch, which slows things down a lot.

I also see that you have made it so it goes into background mode when closed. I see your point but I think I prefer the app closing completely when the user presses X. Though there could be an option to change this behavior.

I also changed the PyQt6 dependency to PySide6, because PyQt's license, from what I've seen, could cause problems with Varia's MPL license.

Thus, this is the state I have ended up with, but so far it doesn't work through Flatpak. If we could fix this I think this is going to be a great feature.
@N0tACyb0rg
Copy link
Contributor Author

Alright, I've rewritten the system tray as a separate program in Rust that communicates with the main Varia program over D-Bus. It's most likely not cross-platform right now, but I will look into adding a dependency called pystray for the Mac and Windows versions. It should work with the Flatpak since it is running over Rust and the ksni standard instead of Qt.

…ibrary

and it's now possible to build as Flatpak.
@giantpinkrobots
Copy link
Owner

Nice work, it works pretty well on Linux. I made it possible to build as Flatpak now as well.

DBus has a Windows version so I thought I could get it to work on Windows as is. I tried some other dbus libraries as dbus-python wouldn't build on Windows (hence the switch to dbus-next). dbus-next does build and seems to run but whatever I did I couldn't get it to work. Varia does communicate with the dbus-daemon on Windows as it prints some things but tray-server still can't communicate with the Rust program.

I decided to push the dbus-next reimplementation nonetheless because it seems to have less dependencies to build on Flatpak and is apparently newer and better from what I read - though I had also managed to get dbus-python to build on Flatpak so we can revert back to your implementation as well if need be.

@N0tACyb0rg
Copy link
Contributor Author

Before you push, I was planning on creating a pystray implementation for other non-Linux platforms, I just need to get around to it.

@giantpinkrobots
Copy link
Owner

If the pystray implementation you plan on doing will be further complicated by my dbus-next commit then we can revert back to your previous commit as I said.

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.

Support for tray icon
2 participants