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

macos shadow dock and menu don't quit #2263

Open
totaam opened this issue Apr 8, 2019 · 0 comments
Open

macos shadow dock and menu don't quit #2263

totaam opened this issue Apr 8, 2019 · 0 comments
Milestone

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 8, 2019

No idea what's going on here, this API looks buggy.

Here are some of the things I've tried before giving up:

--- xpra/server/shadow/gtk_shadow_server_base.py	(revision 22344)
+++ xpra/server/shadow/gtk_shadow_server_base.py	(working copy)
@@ -201,11 +201,34 @@
             tw.cleanup()
 
     def setup_tray(self):
+        from xpra.gtk_common.gobject_compat import import_gtk
+        gtk = import_gtk()
+        from xpra.gtk_common.gtk_util import menuitem
         if OSX:
+            from xpra.platform.darwin.gui import get_OSXApplication
+            #self.dock_menu = gtk.Menu()
+            #self.quit_dock_item = gtk.MenuItem("Quit Me")
+            #self.quit_dock_item.connect("activate", self.quit)
+            #self.dock_menu.add(self.quit_dock_item)
+            #self.dock_menu.show_all()
+            macapp = get_OSXApplication()
+            #macapp.set_dock_menu(self.dock_menu)
+            def quit_handler(*_args):
+                log.info("quit_handler")
+            macapp.connect("NSApplicationWillTerminate", quit_handler)
+            item = menuitem("Blah", cb=quit_handler)
+            menu = gtk.Menu()
+            #item.set_submenu(submenu)
+            #item.show_all()
+            menu.append(item)
+            menu.show_all()
+            from xpra.platform.darwin.osx_menu import getOSXMenuHelper
+            mh = getOSXMenuHelper(None)
+            mh.add_to_app_menu("Top", menu)
+            #self.menu_bar.add(item)
+            #macapp.insert_app_menu_item(item, 0)
             return
         try:
-            from xpra.gtk_common.gobject_compat import import_gtk
-            gtk = import_gtk()
             from xpra.gtk_common.gtk_util import popup_menu_workaround
             #menu:
             label = u"Xpra Shadow Server"
@totaam totaam added the v2.5.x label Jan 22, 2021
@totaam totaam added this to the 5.0 milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant