gnome-hud icon indicating copy to clipboard operation
gnome-hud copied to clipboard

Qt apps menu disappears [question]

Open logix2 opened this issue 5 years ago • 10 comments

This is a question, as this is not an issue with gnome-hud itself, but it is related to its setup.

After setting up gnome-hud in Ubuntu (and installing its dependencies), I no longer get a menu in Qt application windows (I've observed this with VLC and VirtualBox, I'm not sure if it affects Qt4 apps too). I get this error when running VLC, after setting up gnome-hud:

$ vlc
VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
[0000560cb0969630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Failed to unregister window menu, reason: org.freedesktop.DBus.Error.UnknownMethod ("Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 654, in _message_cb
    (candidate_method, parent_method) = _method_lookup(self, method_name, interface_name)
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 246, in _method_lookup
    raise UnknownMethodException('%s is not a valid method of interface %s' % (method_name, dbus_interface))
dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: UnregisterWindow is not a valid method of interface com.canonical.AppMenu.Registrar
")
[0000560cb09fedc0] main playlist: playlist is empty
Failed to unregister window menu, reason: org.freedesktop.DBus.Error.UnknownMethod ("Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 654, in _message_cb
    (candidate_method, parent_method) = _method_lookup(self, method_name, interface_name)
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 246, in _method_lookup
    raise UnknownMethodException('%s is not a valid method of interface %s' % (method_name, dbus_interface))
dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: UnregisterWindow is not a valid method of interface com.canonical.AppMenu.Registrar
")
QObject::~QObject: Timers cannot be stopped from another thread

Do you know a way to get the menu back in Qt applications or what could be causing this?

logix2 avatar Nov 29 '18 15:11 logix2

Hi @logix2, on Arch Linux with appmenu-gtk-module, the menu-bars disappear for all the applications.

Could you try with master branch, to see if the errors are fixed, or try without running gnomehud-service.

jonian avatar Nov 29 '18 18:11 jonian

Interesting. Both Gtk2 (GIMP) and Gtk3 (e.g. Nemo) apps in Ubuntu 18.10 have menus, only Qt(5) applications don't have one.

Regarding your request - VLC no longer shows any errors. The other bug I reported today (with the Gtk hud not being displayed properly in multi-monitor setups) is fixed as well.

About not having any menus when using this... that's a major deal-breaker. There's no workaround of some sort for this I guess?

logix2 avatar Nov 29 '18 18:11 logix2

@jonian this is why rolling the menubar into the HUD is a good. The unity patches, modules and features (whether it's appmenu or unity) are all designed to hide the menu inside application.You can't rely on the application showing the menubar when you use the unity code and its derivatives.

But if you integrate the menubar into the HUD, then there is no problem. It's will always be there.

ripefig avatar Nov 30 '18 07:11 ripefig

@ripefig

integrate the menubar into the HUD

What that means?

@jonian Please see, the appmenu-gtk-module only work with gtk applications. Then the appmenu-gtk-module have nothing to be with a Qt failure. What is occurring here is that the concept for HUD applications don' t exist in Qt. So, when the com.canonical.AppMenu.Registrar dbus service is enable, then the Qt application hidden his menubar, not matter any other semantics you want with this, because there are not more semantics actually there. So, you can not have HUD for Qt without hide the menubar, until this will be resolved in the appmenu-qt package some how. The mate developers could also be interest in have a thing like that for Qt applications.

Also the Gtk2 (GIMP) applications are affected with this problematic, but as they are few, this is not important as is for the Qt applications. This is because there are not a gtk-shell-show-menubar property in Gtk2. Only ubuntu have a patch to allow this property and other distributions have not an equivalent. So, the appmenu-gtk-module also detect the presence of com.canonical.AppMenu.Registrar to hide the Gtk2 menubar. The unity-gtk-module don' t do that for Gtk2, because in ubuntu they patch Gtk2 to add that property. So, if you are in ubuntu using unity-gtk-module, GIMP will follow the gtk-shell-show-menubar, but not outside Ubuntu and not if you are using the appmenu-gtk-module, not matter where.

Also as a suggestion please, replace the bamf with directly calls to X11, then please try to find if you are or not in X11 to then call the X11 functions. Please see appmenu-gtk-module also support Wayland but unity-gtk-module don't support it. So, currently you have X11 support only, but you can have also Wayland support. The problem in Wayland is just to know the current active window, but also some workarounds can be implemented to ask Mutter over Dbus what you want to know with the Eval function. This also can replace the X11 calls if you only want to support the gnome desktops.

lestcape avatar Dec 03 '18 03:12 lestcape

@lestcape Thank you for the detailed information.

Also as a suggestion please, replace the bamf with directly calls to X11

In earlier versions, I was using X11 (https://github.com/hardpixel/gnome-hud/blob/bc9e173415e043e90c82bbb91f3b492ca1b0e396/utils/ewmh.py), so maybe I will revert to that.

ask Mutter over Dbus what you want to know with the Eval function

I have implemented that in wayland branch (https://github.com/hardpixel/gnome-hud/blob/wayland/gnomehud/utils/shell.py) and it works very well, but as you say it only works on Gnome.

As a workaround for the hidden menubar, I was thinking to add a shortcut (eg. Alt), that will stop com.canonical.AppMenu.Registrar and allow the menu to show.

jonian avatar Dec 03 '18 09:12 jonian

image

Full size HUD with menu-bar at the top. It has a bunch of other crap in there too, bu the menu-bar is the main thing.

More here https://medium.com/@leftcrane/gui-hud-using-global-menu-features-hacks-572760272168

ripefig avatar Dec 03 '18 14:12 ripefig

@ripefig That is very nice but it requires a lot of work and I do not have the time to implement it.

jonian avatar Dec 03 '18 15:12 jonian

Oh yeah, clearly. You don't really need the other bells and whistles, but you would need to draw the menubar widget somewhere for the HUD idea to be workable.

ripefig avatar Dec 03 '18 15:12 ripefig

In earlier versions, I was using X11

My point in the request is that bamf don' t add any advance to your procedure while complicate settings for novice users. So, you can have a different perception about it, that is just a recommendation.

I have implemented that in wayland branch

Ohh very nice. I think you can select your provider and have all providers you need in the same application to react base on the environment to continues the support for all of them.

and it works very well

Sure, i was who implemented the Wayland support for the appmenu-gtk-module :). LOL, It work from sure ahhhh....

As a workaround for the hidden menubar, I was thinking to add a shortcut (eg. Alt), that will stop com.canonical.AppMenu.Registrar and allow the menu to show.

This is more less the same workaround of mate. But have some inconveniences.

Also please notice that Qt have a bug that don' t allow to reconnect the applications to the com.canonical.AppMenu.Registrar once the Dbus service is killed and reappeared on the session bus. So, you will have not updates for the Qt menubar once you killed it the first time. That make the actually Mate workaround a sub-optimal solution to me. But is better than nothing for sure. Anyway i already think is better try to find a solution directly where the problem is, in the appmenu-qt package.

lestcape avatar Dec 03 '18 15:12 lestcape

@ripefig thanks for the explanation.

lestcape avatar Dec 03 '18 16:12 lestcape