Zren / material-decoration

Material-ish window decoration theme for KWin, with LIM, based on zzag's original design.
GNU General Public License v2.0
199 stars 17 forks source link

Appmenu doesn't appear for windows spawned from tray icons. #63

Open b1scu1t opened 2 years ago

b1scu1t commented 2 years ago

The current behavior of LIM is flaky if windows spawn/de-spawn. I currently have Strawberry Music Player (Qt5) with the tray icon enabled to toggle the main window. If I were to press 'X' to close the window, but re-spawn it by pressing the tray icon, the window will appear with no menu. It can be replicated every time, and it can be done with multiple applications. The Claws E-mail Client has a similar issue, but it happens every time the main window is toggled with the tray icon.

https://user-images.githubusercontent.com/41207956/170171992-746bfb8c-0ace-4cca-ab57-87fe8e9b211e.mp4

To make the menu re-appear, one must kill the application and relaunch it. ~The problem doesn't occur in Psifodoto's appmenu widget (as often).~ Edit: Nope, happens there too. However, if you were to swap between the default Breeze and this decoration, the menu button will sometimes re-appear there.

Operating System: openSUSE Leap 15.3 KDE Plasma Version: 5.24.5 KDE Frameworks Version: 5.94.0 Qt Version: 5.15.2 Kernel Version: 5.3.18-150300.59.68-default (64-bit) Graphics Platform: X11 Processors: 4 × Intel® Core™ i5-3320M CPU @ 2.60GHz Memory: 7.6 GiB of RAM Graphics Processor: Mesa DRI Intel® HD Graphics 4000

Zren commented 2 years ago

Open Konsole. Type xprop and hit Enter. Then click the Stawberry window. There should be something like:

_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/27"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = ":1.56"
b1scu1t commented 2 years ago

When Strawberry has the LIM working.

_NET_WM_ICON_NAME(UTF8_STRING) = 
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Strawberry Music Player"
_NET_WM_NAME(UTF8_STRING) = "Strawberry Music Player"
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 52860121
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x2200008
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                window id # of group leader: 0x2200008
WM_CLIENT_MACHINE(STRING) = "Leap.T430"
_NET_WM_PID(CARDINAL) = 2749
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 35651591
WM_CLASS(STRING) = "strawberry", "strawberry"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 114, 70
                user specified size: 1138 by 630
                program specified minimum size: 658 by 215
                window gravity: Static

When Strawberry's LIM doesn't show

XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Strawberry Music Player"
_NET_WM_NAME(UTF8_STRING) = "Strawberry Music Player"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x2200008
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x2200008
WM_CLIENT_MACHINE(STRING) = "Leap.T430"
_NET_WM_PID(CARDINAL) = 2749
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 35651605
WM_CLASS(STRING) = "strawberry", "strawberry"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 114, 70
                user specified size: 1138 by 630
                program specified minimum size: 658 by 215
                window gravity: Static

In both instances, the 'KDE_NET_WM_APPMENU' line isn't seen in xprops output.

When Claws Mail (GTK3) LIM works.

_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/34"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = "org.kde.plasma.gmenu_dbusmenu_proxy"

When Claws Mail LIM doesn't work.

_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/35"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = "org.kde.plasma.gmenu_dbusmenu_proxy"
b1scu1t commented 2 years ago

I think it is related to this: https://github.com/Zren/material-decoration/issues/43, specifically the problem the user encountered with Virt Manager.

Zren commented 2 years ago

In both instances, the 'KDE_NET_WM_APPMENU' line isn't seen in xprops output.

What about the stuff above the app icon?

# Filter out the app icon
xprop -f _NET_WM_ICON 8i
# Sort (most) keys+values, breaking the multiline values.
xprop -f _NET_WM_ICON 8i | sort
b1scu1t commented 2 years ago

Strawberry with LIM working.

Client accepts input or input focus: True
                icon window: 0x0
_KDE_NET_WM_ACTIVITIES(STRING) = "b7a1258d-7ce5-442f-a07e-134d0e623274"
_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/1"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = ":1.1468"
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 22, 0
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 56205709
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 22, 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_DESKTOP(CARDINAL) = 4294967295
_NET_WM_ICON(CARDINAL): Type mismatch: assumed size 8 bits, actual size 32 bits.
_NET_WM_ICON_GEOMETRY(CARDINAL) = 169, 740, 36, 28
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_NAME(UTF8_STRING) = "Strawberry Music Player"
_NET_WM_PID(CARDINAL) = 10883
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_SKIP_PAGER
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 35651591
_NET_WM_USER_TIME(CARDINAL) = 59952673
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
                program specified minimum size: 658 by 215
                user specified location: 114, 70
                user specified size: 1138 by 630
                window gravity: Static
                window id # of group leader: 0x2200008
                window state: Normal
WM_CLASS(STRING) = "strawberry", "strawberry"
WM_CLIENT_LEADER(WINDOW): window id # 0x2200008
WM_CLIENT_MACHINE(STRING) = "Leap.T430"
WM_HINTS(WM_HINTS):
WM_NAME(STRING) = "Strawberry Music Player"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_STATE(WM_STATE):
XdndAware(ATOM) = BITMAP
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1

Strawberry with non-working LIM.

           Client accepts input or input focus: True
                icon window: 0x0
_KDE_NET_WM_ACTIVITIES(STRING) = "b7a1258d-7ce5-442f-a07e-134d0e623274"
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 22, 0
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 60054173
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 22, 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_DESKTOP(CARDINAL) = 4294967295
_NET_WM_ICON(CARDINAL): Type mismatch: assumed size 8 bits, actual size 32 bits.
_NET_WM_ICON_GEOMETRY(CARDINAL) = 169, 740, 36, 28
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_NAME(UTF8_STRING) = "Strawberry Music Player"
_NET_WM_PID(CARDINAL) = 10883
_NET_WM_STATE(ATOM) = _NET_WM_STATE_SKIP_PAGER
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 35651614
_NET_WM_USER_TIME(CARDINAL) = 60052297
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
                program specified minimum size: 658 by 215
                user specified location: 114, 70
                user specified size: 1138 by 630
                window gravity: Static
                window id # of group leader: 0x2200008
                window state: Normal
WM_CLASS(STRING) = "strawberry", "strawberry"
WM_CLIENT_LEADER(WINDOW): window id # 0x2200008
WM_CLIENT_MACHINE(STRING) = "Leap.T430"
WM_HINTS(WM_HINTS):
WM_NAME(STRING) = "Strawberry Music Player"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_STATE(WM_STATE):
XdndAware(ATOM) = BITMAP
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1

Sorry for the late response.

b1scu1t commented 2 years ago

I must add that the bug doesn't occur in KTorrent at all.

   Client accepts input or input focus: True
                icon window: 0x0
                Initial state is Normal State.
_KDE_NET_WM_ACTIVITIES(STRING) = "b7a1258d-7ce5-442f-a07e-134d0e623274"
_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/1"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = ":1.3189"
_KDE_NET_WM_DESKTOP_FILE(UTF8_STRING) = "org.kde.ktorrent"
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 22, 0
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 22, 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_DESKTOP(CARDINAL) = 1
_NET_WM_ICON(CARDINAL): Type mismatch: assumed size 8 bits, actual size 32 bits.
_NET_WM_ICON_GEOMETRY(CARDINAL) = 389, 740, 36, 28
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_NAME(UTF8_STRING) = "D: 0 B/s | U: 0 B/s \342\200\224 KTorrent"
_NET_WM_PID(CARDINAL) = 32424
_NET_WM_STATE(ATOM) = 
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 71303181
_NET_WM_USER_TIME(CARDINAL) = 125763651
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
                program specified minimum size: 717 by 474
                user specified size: 1234 by 584
                window gravity: Static
                window id # of group leader: 0x440000e
                window state: Normal
WM_CLASS(STRING) = "ktorrent", "ktorrent"
WM_CLIENT_LEADER(WINDOW): window id # 0x440000e
WM_CLIENT_MACHINE(STRING) = "Leap.T430"
WM_HINTS(WM_HINTS):
WM_NAME(STRING) = "D: 0 B/s | U: 0 B/s"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_STATE(WM_STATE):
WM_WINDOW_ROLE(STRING) = "MainWindow#1"
XdndAware(ATOM) = BITMAP
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1

Also, the bug affects KDE's default Global Menu as well. I assume the LIM decoration and Psifidoto's Appmenu are based on KDE's implementation. Should I close this bug and report it upstream?

b1scu1t commented 2 years ago

This bug is inconsistent, it doesn't occur for all Qt or GTK apps with the tray feature. So the workaround is to disable Global Menu on the one-or-two misbehaving apps. For anyone with this problem, edit the desktop file of the application (right-click on the KDE kick-off, select 'Edit Applications' and search for the app) and prefix the Exec or Command line with:

KDE_NO_GLOBAL_MENU=1

For example: KDE_NO_GLOBAL_MENU=1 strawberry %U

b1scu1t commented 2 years ago

For anyone wanting to disable a GTK application's menu, using Valapanel's `appmenu-gtk-module' instead of Unity's will allow it.

For a specific GTK application.

1. Install and launch Dconf Editor (GUI)
2. Navigate to /org/appmenu/gtk-module/blacklist. The description should be 'Application Blacklist
3. Toggle 'Use Default Value' off.
4. Add the GTK application's executable name to list in the Custom Value box. E.g ['anjuta', 'freeciv', 'freeciv-gtk2', 'freeciv-gtk3', 'glade', 'gwyddion', 'app_name_here'].
5. After committing changes, re-launch the misbehaving application. The menu-bar should re-appear there. If it doesn't, manually enable the menu-bar with a keybind (usually Ctrl-M, Alt, Alt-M, or Ctrl-F12 (in Claws Mail's case...).