kotelnik / plasma-applet-active-window-control

Plasma 5 applet for controlling currently active window.
GNU General Public License v2.0
120 stars 18 forks source link

weird empty buttons in gtk applications (it doesn't happen in plasma's menu applet) #146

Open kupiqu opened 6 years ago

kupiqu commented 6 years ago

Not sure where to submit issues anymore, but for the case this reaches you...

I tested this issue in all gtk applications that I have installed in my system, that is inkscape, gimp libreoffice (gtk theme) and simple-scan. What happens is the following:

None of these issues occurs in plasma's applet: no empty buttons, and functionality of simple-scan is not affected.

trmdi commented 6 years ago

It seems that the dev has dropped this project. He hasn't replied anyone for a long time.

kupiqu commented 6 years ago

I guess so. I'm using the official plasma globalmenu applet, which is more reliable.

trmdi commented 6 years ago

I've just opened a new WISHLIST for adding AWC features to the official Global menu widget at: https://bugs.kde.org/show_bug.cgi?id=399308 Please vote for it.

kupiqu commented 6 years ago

I replied to it. Let me know if you'd be interested in my modified applets:

  1. I made an applet that basically displays the application name.

  2. I made an applet that, in addition, includes plasma's offcial global menu.

trmdi commented 6 years ago

inkscape, gimp and libreoffice show an empty first button and then the rest of the regular menu buttons. functionality of the proper menu buttons is not affected.

It doesn't happen here. image

Did you try compiling and install it from the source on KDE repo ?

kupiqu commented 6 years ago

Did you try compiling and install it from the source on KDE repo ?

Yes. That is what I did.

I tested that in gimp 2.8, I'm not sure about gimp 2.10, or perhaps it was sth that appeared for plasma < 5.14, not sure.

Did you check the others (inkscape, libreoffice and, in particular simple-scan crash)?

trmdi commented 6 years ago

Yes, they look the same. What is your distro? Did you try removing AWC from your panel then add another one? (Do not undo it) I've not had any problem with it for a long time, include Plasma < 5.14

kupiqu commented 6 years ago

KDE neon User Edition. I used AWC for long time, I did all this process properly long time ago.

I guess I can double check if I can reproduce these issues at this point, with new plasma, etc.

trmdi commented 6 years ago

Could you try it on a openSUSE Tumbleweed VM? I'm using it.

kupiqu commented 6 years ago

Could you try it on a openSUSE Tumbleweed VM? I'm using it.

Sorry, but I don't have the time right now to install a new VM with a different OS and test this. What I can do is to re-test this in my system and if it still happens, perhaps you can run a VM with KDE neon and see it it can be reproduced or not... but in any case, let me first check this out again as I didn't since August.

kupiqu commented 6 years ago

I just tested again. Nothing changed wrt last time. If it works for you, it might be that I'm not compiling it properly, although I always compile the same way and didn't experience any issue with other code.

This is what I do:

cmake .. -DCMAKE_INSTALL_PREFIX=`kf5-config --prefix=` -DKDE_INSTALL_QTPLUGINDIR=/usr/lib/x86_64-linux-gnu/qt5/plugins -DKDE_INSTALL_LIBDIR=x86_64-linux-gnu/qt5  -DCMAKE_BUILD_TYPE=Release 

make

sudo make install

How are you compiling it?

[ Just a correction wrt previous comment, simple-scan didn't crash, it was just not functional, that is, it didn't trigger any of the pop-up settings ]

trmdi commented 6 years ago

Did you try with a new user?

kupiqu commented 6 years ago

No, I uninstalled the applet and reinstalled it following the exact instructions. I really think there is a bug there...

trmdi commented 6 years ago

Please try it. Sometimes issues could come from config files.

kupiqu commented 6 years ago

I would understand the menu not appearing at all, but config files making empty buttons appearing specifically for gtk apps seems a bit weird. I would be surprised if I see differently, but I will try it anyway... it wouldn't be the first time that I say that and then get surprised ;)

Zren commented 6 years ago

Note, GTK2 apps like Gimp 2.8.16 doesn't show menu items for me either. Firefox which is GTK 3 does though. I'm thinking that it's a package we're both missing. The 5.14.0 release notes links to a blog post https://blog.broulik.de/2018/03/gtk-global-menu/ mentioning appmenu-gtk-module.

... appmenu-gtk-module (or unity-gtk-module for pre-Gnome Ubuntu) enabling global menu for a wide selection of applications, including Gimp, Inkscape, Sublime Text, Audacity, and many more.

Once I've finished my bionic upgrade in an hour or so, I'll test installing some of the stuff that shows up for apt search appmenu-gtk.

kupiqu commented 6 years ago

EDIT: I use KDE neon User Edition 18.04

Please note that I DO have menues for gtk2 applications, and they work perfectly with plasma's official globalmenu, that's not the issue, the issue is in AWC for gtk apps (not only gtk2) creating empty buttons before the first menu, and making simple-scan not responsive. Nothing of this happens with the official plasma global menu applet.

These are the packages I have installed in my system:

ii  libdbusmenu-glib4:amd64                         16.04.1+18.04.20171206-0ubuntu1                  amd64        library for passing menus over DBus
ii  libdbusmenu-gtk3-4:amd64                        16.04.1+18.04.20171206-0ubuntu1                  amd64        library for passing menus over DBus - GTK+ version
ii  libdbusmenu-gtk4:amd64                          16.04.1+18.04.20171206-0ubuntu1                  amd64        library for passing menus over DBus - GTK+ version
ii  libdbusmenu-qt2:amd64                           0.9.3+16.04.20160218-1ubuntu1                    amd64        Qt implementation of the DBusMenu protocol
ii  libdbusmenu-qt5-2:amd64                         0.9.3+16.04.20160218-1ubuntu1                    amd64        Qt implementation of the DBusMenu protocol
ii  appmenu-gtk-module-common                       0.6.94-1                                         all          Common files for GtkMenuShell D-Bus exporter
ii  appmenu-gtk2-module:amd64                       0.6.94-1                                         amd64        GtkMenuShell D-Bus exporter (GTK+2.0)
ii  appmenu-gtk3-module:amd64                       0.6.94-1                                         amd64        GtkMenuShell D-Bus exporter (GTK+3.0)
ii  appmenu-qt:amd64                                0.2.7+14.04.20140305-0ubuntu2                    amd64        application menu for Qt
ii  libappmenu-gtk2-parser0:amd64                   0.6.94-1                                         amd64        GtkMenuShell to GMenuModel parser (GTK+2.0)
ii  libappmenu-gtk3-parser0:amd64                   0.6.94-1                                         amd64        GtkMenuShell to GMenuModel parser (GTK+3.0)
trmdi commented 6 years ago

Did you try a new user like I said above ?

Inkscape: image

kupiqu commented 6 years ago

Yes, just did, same thing

trmdi commented 6 years ago

Then wait until Zren finishes his upgrading... That's weird!

Zren commented 6 years ago

Hmmm, testing the xenial version of gimp, GTK_MODULES=unity-gtk-module gimp seems to work without installing appmenu-gtk3-module. As the blog post says, the env var will be different for bionic though.

That said, I see what you mean. Here's a screenshot using the breeze-alphablack desktop theme.

Running xprop then clicking the gimp window shows us:

_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/3"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = "org.kde.plasma.gmenu_dbusmenu_proxy"
_GTK_MENUBAR_OBJECT_PATH(UTF8_STRING) = "/com/canonical/unity/gtk/window/0"
_UNITY_OBJECT_PATH(UTF8_STRING) = "/com/canonical/unity/gtk/window/0"
_GTK_UNIQUE_BUS_NAME(UTF8_STRING) = ":1.111"

Skimming qdbusviewer for :1.111 .../window/0 org.gtk.Actions, we have a List method that just lists all the action ids, which isn't very helpful.

{"script-fu-distress-selection", "view-show-selection", "plug-in-retinex", "image-resize", "tools-color-balance", "tools-transform-menu", ...}

There's also a DescribeAll method which should be more relevant. One of these qdbus methods should list what that menu item is.

Received reply from :1.111
  Arguments: [Argument: a{s(bgav)} {"script-fu-distress-selection" = [Argument: (bgav) false, [Signature: ], [Argument: av {}]], "view-show-selection" = [Argument: (bgav) false, [Signature: ], [Argument: av {[Variant(bool): false]}]], "plug-in-retinex" = [Argument: (bgav) false, [Signature: ], [Argument: av {}]], "image-resize" = [Argument: (bgav) false, [Signature: ], [Argument: av {}]], "tools-color-balance" = [Argument: (bgav) true, [Signature: ], [Argument: av {}]], "tools-transform-menu" = [Argument: (bgav) true, [Signature: ], [Argument: av {}]], "-Image--Filters-Languages-Script-Fu" = [Argument: (bgav) true, [Signature: ], [Argument: av {}]], "plug-in-reshow" = [Argument: (bgav) false, [Signature: ], [Argument: av {}]], "view-show-sample-points" = [Argument: (bgav) false, [Signature: ], [Argument: av {[Variant(bool): false]}]], "layers-transparency-menu-0" = [Argument: (bgav) true, [Signature: ], [Argument: av {[Variant(bool): true]}]], "edit-fill-pattern" = [Argument: (bgav) false, [Signature: ], [Argument: av {}]], 
kupiqu commented 6 years ago

Can you try moving the mouse just before the File button in, e.g., inkscape and see if there is an empty button that gets highlighted for you too? If so, you should see the blue line on hovering over the button (a small rectangle) but no label

trmdi commented 6 years ago

Can you post a screenshot ? @kupiqu

kupiqu commented 6 years ago

Oh finally, @Zren can reproduce it! @trmdi just look screenshot above :)

Now, the thing is that this doesn't happen at all with the official global menu

trmdi commented 6 years ago

Ah, I thought it was a different thing. I have it here too. Sorrry :rofl:

kupiqu commented 6 years ago

and you didn't try simple-scan to see it doesn't work either ;)

trmdi commented 6 years ago

I thought you'd been talking about a much wider space !

kupiqu commented 6 years ago

It was never about space, it was about empty buttons :)

kupiqu commented 6 years ago

It was never about space, it was about empty buttons :)

space is small because there is no label

trmdi commented 6 years ago

Sorry, let's see how Zren would fix it. Though it's not a big problem to me.

Zren commented 6 years ago

Looks like GlobalMenu hides buttons with empty text:

While AWC does not. It also uses... MouseArea's instead of ToolButtons for some reason. Interesting. Wonder why that is.

kupiqu commented 6 years ago

Well, it's not very polished to have empty buttons around, and much worse is to lose functionality as for simple-scan, making the application totally useless.

@Zren Yes, there are diffs between the two, so that's why I try to convince you to be as close as the official as possible... I'll try to upload my applet to github asap (but first need to check that is up-to-date wrt my other applet that doesn't integrate the global menu; didn't find the time yet)

trmdi commented 6 years ago

Could we replace the old code of AWC with the updated one from the official Global menu?

kupiqu commented 6 years ago

Yes, thats what I did!

trmdi commented 6 years ago

... and keep (and update) other parts of AWC. That's why I want a new maintainer for AWC when the original dev'd dropped it!

kupiqu commented 6 years ago

I'll try to upload my applet to github asap (but first need to check that is up-to-date wrt my other applet that doesn't integrate the global menu; didn't find the time yet)

Actually there's no need to upload to github, the important changes just appear in main.qml, please see the attachment:

main.qml.zip

Edit: I'm sure there will be better ways to do it, but hopefully helps

trmdi commented 6 years ago

I think the best way if possible is to "embed" the official Global menu into a AWC container (or use it as a library...), instead of copy code from Global menu. Otherwise AWC could easily be "outdated" in the future. I see there's been commits to Global menu recently.

kupiqu commented 6 years ago

Totally agree, that's why I encouraged to modify the official plasma global menu applet in the first place. As that does not seem possible at this point, I then encouraged embedding it.

If it's not done in that code is because I don't know how... not sure that code is of any use for AWC, but at least it shows it can be done. I'm sure @Zren will find the best way to combine AWC and the official global menu.

saligari commented 6 years ago

Sorry for hijacking this conversation and going off-topic, @kupiqu how did you uninstall this widget when built from git?

kupiqu commented 6 years ago

sudo make uninstall

Zren commented 6 years ago

Apparently it's a seperator.

{"enabled" = [Variant(bool): true], "label" = [Variant(QString): ""], "type" = [Variant(QString): "separator"], "visible" = [Variant(bool): true]}

https://phabricator.kde.org/D16394

kupiqu commented 6 years ago

That explains why simple-scan has two of them:

simple-scan has two of those empty buttons, the second may come from a separator in the application between menu entries preferences (the first one) and then the rest (Keyboard shorcuts, and so on). In this case functionality is affected. Clicking on the buttons is not responsive.

Zren commented 6 years ago

The master branch of https://phabricator.kde.org/source/plasma-active-window-control/ now has the fix.

I'll be adding complete install instructions in a ReadMe, but here's what I have so far:

git clone https://github.com/KDE/plasma-active-window-control
cd plasma-active-window-control

TODO: I'll need to figure out the exact build dependencies.

Then build it.

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
make
sudo make install
kupiqu commented 6 years ago

Nice. Does the new version fix the issue on simple-scan as well (i.e., buttons not being responsive)?