Bug 484165 - KWin Window Rules for Virtual Desktop show as "All Desktops" despite it actually being the correct (last-set) desktop choice. (X11 Only)
Summary: KWin Window Rules for Virtual Desktop show as "All Desktops" despite it actua...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kwinrules (show other bugs)
Version: 6.0.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: X11-only
Depends on:
Blocks:
 
Reported: 2024-03-21 13:57 UTC by Hammad R
Modified: 2025-02-25 19:30 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hammad R 2024-03-21 13:57:10 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

When setting a Virtual Desktop for a window using Window Rules, choosing a virtual desktop for the rule (despite whether the action is to remember, force, apply initially, etc) and saving the rule, then going back and and clicking on the rule, the "saved choice" for the virtual desktop is "All Desktops". However, the rule actually does work with the last saved desktop. And changing it to the desktop of choice again the Apply button is greyed out, indicating that the choice was saved correctly. Manually changing it back to "All Desktops" makes the Apply button clickable, proving again that it only initially shows it as "All Desktops" despite the correct virtual desktop choice being saved in the rule configuration.

STEPS TO REPRODUCE
1. Make a window rule for any window, and add a property of "Virtual Desktop"
2. Set it as any virtual desktop, and save the rule.
3. Go back and then go into the rule again. You will see it says "All Desktops" despite that not being the saved configuration.

OBSERVED RESULT
Virtual desktop choice is set to "All Desktops" when the rule is opened.

EXPECTED RESULT
Virtual desktop choice is set to the saved choice of virtual desktop when the rule is opened.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Hammad R 2024-03-21 14:13:48 UTC
Linux ver 6.8.1-arch1-1
KDE Plasma ver 6.0.2
KDE Frameworks ver 6.0.0
QT version 6.6.2
Graphics Platform X11
Comment 2 Miranda 2024-04-20 04:20:18 UTC
I can confirm this bug.  Still exists in 6.0.4

Kernel: 6.8.7-zen1-zen
KDE Plasma version: 6.0.4
KDE Frameworks version: 6.1.0
QT version: 6.7.0
Graphics Platform: X11
Comment 3 Thomas Carmichael 2024-05-31 10:15:13 UTC
This bug is present in 6.0.5 as well.

Operating System: EndeavourOS 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.9.2-arch1-1 (64-bit)
Graphics Platform: X11
Comment 4 Hammad R 2024-07-08 21:54:47 UTC
This actually only occurs on X11. I recently got Wayland working (by use of the modeset nvidia-drm kernel parameter) and this bug does not happen on Wayland. On Wayland, opening the rule correctly shows it as Desktop 1.
Comment 5 Bug Janitor Service 2025-02-23 18:54:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7220
Comment 6 TraceyC 2025-02-24 17:59:11 UTC
Adding the x11-only keyword
Comment 7 Ismael Asensio 2025-02-25 18:44:45 UTC
Git commit 810181a01bd2153e2bdd050c1da1dd49c580d4c4 by Ismael Asensio.
Committed on 25/02/2025 at 18:07.
Pushed by iasensio into branch 'master'.

kcms/rules: Fix showing selected VD on X11

Th Rules KCM treats Virtual Desktops differently:
- on wayland is a QStringList and a multiple choice `OptionList`
- on X11 is a QString and a single choice `Option`

The underlaying setting, however, is common and always a QStringList.
This made the check against the possible VDs fail, so the KCM on X11
would resort to show the default value: "All Virtual Desktops".

It was purely a visual failure in how the property was shown, not on
how the rules were saved or applied.

Convert the value to a `QString` in case we have a single `Option` to
fix the issue.
FIXED-IN: 6.3.3

M  +6    -1    src/kcms/rules/ruleitem.cpp

https://invent.kde.org/plasma/kwin/-/commit/810181a01bd2153e2bdd050c1da1dd49c580d4c4
Comment 8 Ismael Asensio 2025-02-25 19:30:16 UTC
Git commit 3088d941c646b63ccea66669ef52585771b9c79c by Ismael Asensio.
Committed on 25/02/2025 at 19:00.
Pushed by iasensio into branch 'Plasma/6.3'.

kcms/rules: Fix showing selected VD on X11

Th Rules KCM treats Virtual Desktops differently:
- on wayland is a QStringList and a multiple choice `OptionList`
- on X11 is a QString and a single choice `Option`

The underlaying setting, however, is common and always a QStringList.
This made the check against the possible VDs fail, so the KCM on X11
would resort to show the default value: "All Virtual Desktops".

It was purely a visual failure in how the property was shown, not on
how the rules were saved or applied.

Convert the value to a `QString` in case we have a single `Option` to
fix the issue.
FIXED-IN: 6.3.3


(cherry picked from commit 810181a01bd2153e2bdd050c1da1dd49c580d4c4)

Co-authored-by: Ismael Asensio <isma.af@gmail.com>

M  +6    -1    src/kcms/rules/ruleitem.cpp

https://invent.kde.org/plasma/kwin/-/commit/3088d941c646b63ccea66669ef52585771b9c79c