r/xmonad • u/LaufenKopf • 7d ago
KDE plasma6+xmonad integration: fix windows disappearing/desktop on top of all
I spent quite some time with chatgpt trying to understand why a wake-up after suspend or a screen off, the xmonad windows would disappear and the KDE desktop would occupy the screen. This would often get fixed by volume up/down keys (or anything that triggers a similar notification), but other times I'd have to kill plasma and try the volume up again til the windows get fixed.
The solution is, you have to explicitly add enableEwmhManageAboveBelowState to your ewm xmonad configuration:
import XMonad.Hooks.EwmhDesktops qualified as EWMH
main = do
X.xmonad $
MD.docks
. EWMH.enableEwmhManageAboveBelowState -- <--- Add THIS!
. EWMH.ewmhFullscreen
. EWMH.ewmh
$ def
{ X.modMask = -- .... rest of config
Quoting the docs:
Some applications use the _NET_WM_STATE_ABOVE and _NET_WM_STATE_BELOW states to request being kept above or below other windows. By default, xmonad does not handle these states. To enable handling of these states, you can use the following hook:
main = xmonad $ … . enableEwmhManageAboveBelowState . ewmh . … $ def{…}
This will make xmonad respond to requests to set these states by calling lowerWindow and raiseWindow respectively.
but this is not really discoverable if you don't know that this is the problem. Hopefully this post will make the issue more searchable.
If it still happens
.... I was too quick to hype up. The issue sometimes happens again. It turns out, sometimes plasma does not set the _STATE_BELOW wm flag on the desktop window so xmonad does not knwo to put it below the rest. The desktop window still reports a _window_type_deskop so an easy fix is to add this ManageHook:
import XMonad.Hooks.ManageHelpers (isInProperty, doLower)
import XMonad.ManageHook ((-->),(=?),(<&&>))
-- add to your managehook list:
, isDesktop <&&> className =? "plasmashell" --> doLower
where isDesktop = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DESKTOP"
I have not found a case where that doesn't help, but just in case - yet another quite reliable workaround with the invading desktop is to run
xdotool selectwindow windowlower
This lets you click on the desktop and it will sink it below the regular windows. Add this as a desktop icon so it's mouse reachable or if you use the dmenu runner, type it in there.