Bug 393788 - Window rules editing broken
Summary: Window rules editing broken
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D12706
Keywords: regression, reproducible
: 394488 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-03 05:44 UTC by Duncan
Modified: 2018-05-20 18:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.13.0
mgraesslin: Wayland+
mgraesslin: X11+
mgraesslin: ReviewRequest+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan 2018-05-03 05:44:16 UTC
The window rules kcm GUI won't save changes.  It will load existing rules from kwinrulesrc (as does kwin itself) and changes will appear to save -- hitting the apply button causes it to go inactive, but:
1) kwin doesn't actually act on them (even after hitting apply).
2) switching to another kcm (say kwin scripts) and back to window rules, the changes were not saved and I get the same rule as when I loaded it the first time.
3) kwinrulesrc isn't actually changed (yes, it's appropriate 0600 perms).

Running gentoo/kde's live-git of frameworks and plasma as well.  Currently running qt-5.11.0_beta4 as plasma-live-git is now requiring > 5.10, and gentoo doesn't have 5.10 in-tree, only 5.11_beta4.  However, this bug triggered before that upgrade.

This has apparently been broken in kwin on X at least for months, as when I unmerged superkaramba (my last kde4 app, so I could unmerge kde4/qt4, still nothing with superkaramba's full set of features for plasma5 that I can find, but this bug isn't about that...) and setup ksysguard graphing to replace what I could of superkaramba, I ended up having to manually edit kwinrulesrc in ordered to get a working rule for ksysguard, and that was a couple months ago or so.  I have a somewhat large but reasonably stable set of kwin window rules and hadn't needed to edit any of them for some time before that, so I've no idea how long it has actually been broken.

Fortunately, I can still edit the kwinrulesrc file manually and the changes do take (after restarting kde/plasma, and I think after simply running kwin_x11 --replace, tho I'd have to check that again to be sure), but it'd sure be nice to have a working GUI editor back again!

(The current trigger to file the bug was full-screening a game that changed the resolution and left the desktop a mess.  I quit and restarted kde/plasma/X, and got the desktop back, but firefox restarted at 0,15 which on my multi-monitor setup is offscreen.  I tried to edit an existing window rule for it to reposition it onscreen, but found the GUI editor still not saving changes, so that didn't work.  Fortunately I have wmctrl installed, and a wmctrl -R firefox did the trick!)

I suppose none of the devs have seen it due to running wayland these days.

(BTW, is plasma-wayland usable now, and can you point me at a good article describing how to configure it analogous to xorg.conf.d?  Or is the only way to configure plasma-wayland via the plasma-wayland GUI?  I haven't had much luck with multi-monitor config GUIs such as kscreen on X/kde/plasma -- while they do work sometimes, they're often broken bad enough to be unusable (leaving me with a sufficiently broken desktop that I must restart X/kde/plasma, I had to studiously avoid that kcm for awhile, as even opening it would screw things up!), so I tend to avoid them, and while xrandr has at least worked more consistently, simply configuring the layout in xorg.conf.d and not touching it from the GUI has been most reliable.  So you can see why I'm hoping there's a wayland analog to xorg.conf.d, despite my not seeing /anything/ about it in the various Linux-related news feeds I follow.  So a link to a good article on the topic would be extremely useful!)
Comment 1 Martin Flöser 2018-05-03 15:24:52 UTC
Which KWin version are you using? I consider it very unlikely that such a central part of KWin could be broken. I at least created a window rule on X11 today.
Comment 2 Duncan 2018-05-04 03:07:26 UTC
(In reply to Martin Flöser from comment #1)
> Which KWin version are you using?

All of kde/plasma/frameworks is live-git.  kwin --version reports 5.12.80, and git show in kwin's repo reports c0226fe74 from Apr 26, but as I said it has been at least a few weeks because (see original report).

> I consider it very unlikely that such a
> central part of KWin could be broken. I at least created a window rule on
> X11 today.

Did it actually apply and save?

Note that I can create and change rules, and hitting OK on the individual rule dialog and then apply in the kcm /appears/ to create and save it -- no visible errors -- but it doesn't actually get saved or affect the window it's supposed to, either -- when I switch to a different kcm and back to reload, the edited rule is just as it was before the edit, and new rules simply aren't there any more.

What I'm /wondering/ is if whatever framework actually saves the changes changed out from under the API the kcm is using to invoke it and the kcm wasn't synced to the changes, with the changes not enough to error out, just enough so the save isn't happening (or maybe it is but to a different location, so it's written to one but read from another).  What framework might that be?  I might try rolling it back a couple months and see if it makes a difference.  Of course  if I knew which one I could report specific git commit on it then as well.

There are a few non-default factors in my setup that could be involved as well.  In particular, I have KDEHOME, KDETMP, KDEVARTMP, XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME set.  If there's a hard-coded path (maybe a place where the default path isn't overridden in the var is set) or one using a different var for read vs. write, it would lead to exactly this sort of symptoms, that would likely not duplicate at all on a system with these vars unset so it uses the default settings.

From konsole (so with the KDE/X env):

$ export | grep 'KDE\|XDG\|HOME'
declare -x HOME="/h/x"
declare -x KDEHOME="/h/x/kde"
declare -x KDETMP="/h/x/tmp/kde"
declare -x KDEVARTMP="/h/x/tmp/cache"
declare -x KDE_FULL_SESSION="true"
declare -x KDE_NO_IPV6="1"
declare -x KDE_SESSION_UID="501"
declare -x KDE_SESSION_VERSION="5"
declare -x KDE_UTF8_FILENAMES="1"
declare -x PROFILEHOME="~"
declare -x XDG_CACHE_HOME="/h/x/tmp/cache"
declare -x XDG_CONFIG_DIRS="/etc/xdg"
declare -x XDG_CONFIG_HOME="/h/x/config"
declare -x XDG_CURRENT_DESKTOP="KDE"
declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
declare -x XDG_DATA_HOME="/h/x/config/share"
declare -x XDG_RUNTIME_DIR="/run/user/501"
declare -x XDG_SEAT="seat0"
declare -x XDG_SESSION_ID="c1"
declare -x XDG_VTNR="1"
Comment 3 Martin Flöser 2018-05-04 04:22:03 UTC
Ok, master makes more sense: there we do have changes.
Comment 4 Martin Flöser 2018-05-05 07:16:00 UTC
I found the change which introduced the regression and have a patch for it: https://phabricator.kde.org/D12706

Luckily it's only in master branch.
Comment 5 Duncan 2018-05-06 06:29:04 UTC
(In reply to Martin Flöser from comment #4)
> I found the change which introduced the regression and have a patch for it:
> https://phabricator.kde.org/D12706
> 
> Luckily it's only in master branch.

Applied locally and confirmed that it fixes the bug here.

Nice to have new rule changes working again!  Lots easier than editing the file manually!

Thanks.  Looking forward to seeing it in git after review. =:^)
Comment 6 Martin Flöser 2018-05-06 17:45:57 UTC
Thanks for testing
Comment 7 Martin Flöser 2018-05-20 13:43:46 UTC
Git commit bed31e0557854bb92425db1eab73022c41f2c793 by Martin Flöser.
Committed on 20/05/2018 at 13:43.
Pushed by graesslin into branch 'Plasma/5.13'.

Reparse rules config prior to update

Summary:
We used to recreate the KConfig when rules needed to update. Now that it
is a KSharedConfig, which is kept, it needs to be reparsed as it changes
outside of KWin.
FIXED-IN: 5.13.0

Test Plan: Restarted session, changing rules work again

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D12706

M  +2    -0    rules.cpp

https://commits.kde.org/kwin/bed31e0557854bb92425db1eab73022c41f2c793
Comment 8 Martin Flöser 2018-05-20 18:21:29 UTC
*** Bug 394488 has been marked as a duplicate of this bug. ***