-
-
Notifications
You must be signed in to change notification settings - Fork 185
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 an option to toggle manager visibility on clicking the tray icon #2347
Conversation
If this is to be an option the gsettings should be handled in the StandardItems applet plugin
With a corresponding option for the PluginManager so users can discover and toggle it. |
@roket1428 let me know if you can and want to make this change. If not I can do it later this week. |
@infirit something like this? |
Apologies I wasn't clear, I forget not everyone is familiar with blueman internals. The logic should now be part of the StandardItems plugin. Also plugins have a convenience function to retrieve options. I suggest something like below on top of your changes. I'm not sold on the name of the setting diff --git a/blueman/main/DBusProxies.py b/blueman/main/DBusProxies.py
index d1226975..27524620 100644
--- a/blueman/main/DBusProxies.py
+++ b/blueman/main/DBusProxies.py
@@ -51,7 +51,7 @@ class ManagerService(ProxyBase):
object_path="/org/blueman/Manager",
flags=Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION)
- def _activate(self) -> None:
+ def activate(self) -> None:
try:
param = GLib.Variant('(a{sv})', ({},))
self.call_sync("Activate", param, Gio.DBusCallFlags.NONE, -1, None)
@@ -79,11 +79,5 @@ class ManagerService(ProxyBase):
param = GLib.Variant('(sava{sv})', (name, [], {}))
self.call('ActivateAction', param, Gio.DBusCallFlags.NONE, -1, None, call_finish)
- def startstop(self) -> None:
- if Gio.Settings(schema_id='org.blueman.plugins.standarditems')['toggle-manager-onclick']:
- if self.get_name_owner() is None:
- self._activate()
- else:
- self._call_action("Quit")
- else:
- self._activate()
+ def quit(self) -> None:
+ self._call_action("Quit")
diff --git a/blueman/plugins/applet/StandardItems.py b/blueman/plugins/applet/StandardItems.py
index a871b1a3..eeea12eb 100644
--- a/blueman/plugins/applet/StandardItems.py
+++ b/blueman/plugins/applet/StandardItems.py
@@ -90,7 +90,10 @@ class StandardItems(AppletPlugin, PowerStateListener):
def on_devices(self) -> None:
m = ManagerService()
- m.startstop()
+ if m.get_name_owner() and self.get_option("toggle-manager-onclick"):
+ m.quit()
+ else:
+ m.activate()
def on_adapters(self) -> None:
launch("blueman-adapters", name=_("Adapter Preferences")) |
Quality Gate passedIssues Measures |
@infirit I applied your changes, but I couldn't find a better alternative to the settings name (I'm open to ideas, though). |
Fixes #2346