Bug 453752 - Effects Settings from XDG_CONFIG_DIRS are discarded when user clicks on [Defaults]
Summary: Effects Settings from XDG_CONFIG_DIRS are discarded when user clicks on [Defa...
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kwineffects (show other bugs)
Version: 5.24.5
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-13 17:21 UTC by Michael Mikowski
Modified: 2022-09-06 19:12 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Mikowski 2022-05-13 17:21:02 UTC
SUMMARY
***
Click on Defaults in `kcmshell5 kcm_kwin_effects` results in apparently hard-coded defaults, not those defined in the `kf5-config --path config` hierarchy. 

***

STEPS TO REPRODUCE
1. Install Kubuntu 22.04

2. Edit `/usr/share/kubuntu-default-settings/kf5-settings` to include the following:
[Plugins]
wobblywindowsEnabled=true

3. Log out and back in. Open `kcmshell5 kcm_kwin_effects` and notice that wobbly windows are indeed enabled (this is not default on stock KDE).

4. Click on the [Defaults] button in the GUI.

OBSERVED RESULT
The wobbly window option erased and there is no simple or easy way for the user to recover the intent from the config path.

EXPECTED RESULT
I think that clicking on [Defaults] should honor the `kf5-config --path config`  so that, for example, Kubuntu defaults can be recovered. Alternately, there may be a system-default vs. KDE defaults option, maybe with a pulldown button so as to not further clutter the interface.  The preferred default should be the config path so as to retain the distribution or vendor intent IMO. 

SOFTWARE/OS VERSIONS
Windows: no
macOS: no
Linux/KDE Plasma: Kubuntu 22.04
(available in About System)
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
We see similar behavior with kglobalshortcutsrc. However, in this case, these don't even get APPLIED during run.
KDE apparently inserts a .config/kdedefaults directory in the config path after changes to the settings, which is also inserted into the xdg-config path before any system paths.  There may be some overlap there.

I am at your service to provide additional testing and assistance. Just let me know if there is any way I can help to get this resolved.
Comment 1 Nate Graham 2022-05-16 17:39:38 UTC
> /usr/share/kubuntu-default-settings/kf5-settings
This is not something KDE supports and appears to be a Kubuntu-specific thing. The correct way to set systemwide defaults is to add them to the relevant config file in /etc/xdg. So in this case, you would want to create a file called /etc/xdg/kwinrc with the following content:

> [Plugins]
> wobblywindowsEnabled=true
Comment 2 Erich Eickmeyer 2022-07-19 20:44:26 UTC
On the contrary, Nate, this is something that should be inherited by $XDG_CONFIG_DIRS in which case /usr/share/kubuntu-default-settings/kf5-settings is added to the path by the distribution. Therefore, by adding a file with a config to the aforementioned directory is inherently doing the same as adding it to /etc/xdg since it is in the same $XDG_CONFIG_DIRS path, at least according to the XDG spec.

This is, of course, unless KDE is deviating from the Open Desktop Guidelines and not using the $XDG_CONFIG_DIRS system variable when searching for config files.
Comment 3 Nate Graham 2022-07-21 17:01:23 UTC
If your packaging adds /usr/share/kubuntu-default-settings to $XDG_CONFIG_DIRS, it's still not going to work unless there's a file called "kwinrc" in there. The cascading feature in kconfig relies on the filename being identical to what's being requested in the code (which is "kwinrc"). So you will need to create /usr/share/kubuntu-default-settings/kwinrc which contains:

[Plugins]
wobblywindowsEnabled=true

Does that work?
Comment 4 Erich Eickmeyer 2022-07-21 17:05:17 UTC
That's exactly what Michael was referring to is that even when a file named "kwinrc" is in that path with those contents, it has no effect when "Defaults" is selected. The initial configuration is honored, but when "Defaults" is selected, it no longer gathers the defaults from the $XDG_CONFIG_DIRS path.
Comment 5 Nate Graham 2022-07-21 17:12:00 UTC
Does the Defaults button work if you copy or move the file to live inside /etc/xdg?
Comment 6 Erich Eickmeyer 2022-07-21 17:13:35 UTC
No, my testing involved using /etc/xdg directly. It's simply not inheriting $XDG_CONFIG_DIRS paths.
Comment 7 Erich Eickmeyer 2022-07-21 17:14:14 UTC
(In reply to Erich Eickmeyer from comment #6)
> No, my testing involved using /etc/xdg directly. It's simply not inheriting
> $XDG_CONFIG_DIRS paths.

Rather, my testing involved both directories.
Comment 8 Nate Graham 2022-07-21 18:15:33 UTC
Can confirm with git master.

As far as I can tell, the default set of enabled effects is determined by the effects' .desktop files, where they can have X-KDE-PluginInfo-EnabledByDefault= set to true or false. Some of these are generated at runtime by JSON files.