When a program queries KWin for the root window property _NET_CURRENT_DESKTOP, fails to respond correctly. According to the FreeDesktop spec on "Extended Window Manager Hints", specifically the section "Root Window Properties (and related messages)", at https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html, window managers _must_ return an integer between 0 and (num_desktops - 1) in response to a query for this property. Expected Behaviour: $ xdotool get_desktop 0 Actual Behaviour: $ xdotool get_desktop XGetWindowProperty[_NET_CURRENT_DESKTOP] failed (code=1) -1 Notes: If one switches workspaces/desktops and tries again, it begins to work. However, after a reboot or just waiting for some time, it agains starts failing. Getting the _NET_NUMBER_OF_DESKTOPS property works: $ xdotool get_num_desktops 4
It looks like this feature has been broken for years without anybody noticing. We only seem to sync to X property when a window switches virtual desktop.
(In reply to Martin Flöser from comment #1) > It looks like this feature has been broken for years without anybody > noticing. We only seem to sync to X property when a window switches virtual > desktop. For me (Arch Linux), this feature is only broken recently. I frequently use a script that calls "xdotool get_desktop". It used to work on kwin-5.11.5 but is broken on 5.12.
(In reply to Martin Flöser from comment #1) > It looks like this feature has been broken for years without anybody > noticing. We only seem to sync to X property when a window switches virtual > desktop. Can confirm jingyu9575's experience. This has been broken only recently, on both Arch Linux and Neon (User edition).
Yeah I misinterpreted the code. An area I didn't expect to be relevant for changing the property actually changes the property on desktop changes. I have a fix for the issue.
patch at: https://phabricator.kde.org/D10836
Git commit 4205496033728c82643e78340b4ddae3079c6280 by Martin Flöser. Committed on 29/03/2018 at 15:50. Pushed by graesslin into branch 'Plasma/5.12'. Ensure _NET_CURRENT_DESKTOP is set on startup Summary: Seems to have regressed in Plasma 5.12 due to code reordering. Now the property is explicitly updated once the NETRootInfo is created. FIXED-IN: 5.12.5 Test Plan: Test case exposing the problem added. Fails without the patch, succeeds with the patch. Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D10836 M +52 -0 autotests/integration/virtual_desktop_test.cpp M +1 -0 workspace.cpp https://commits.kde.org/kwin/4205496033728c82643e78340b4ddae3079c6280
*** Bug 393731 has been marked as a duplicate of this bug. ***