Bug 464228 - feat: read system-wide default configs from /etc/kde/
Summary: feat: read system-wide default configs from /etc/kde/
Status: RESOLVED NOT A BUG
Alias: None
Product: libplasma
Classification: Frameworks and Libraries
Component: libplasma (show other bugs)
Version: unspecified
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-13 08:22 UTC by Milan Hauth
Modified: 2023-01-18 20:40 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Hauth 2023-01-13 08:22:58 UTC
SUMMARY
allow to override kde default settings with global config files in /etc/kde/

ACTUAL
currently, the default settings of kde modules are hard-coded
and that default config can only be changed per user ($HOME/.config/)
but not system-wide = for all users (/etc/kde/)

example: baloo
default config: baloo-5.93.0/src/lib/baloosettings.kcfg
user config: $HOME/.config/baloofilerc

```xml
<!-- baloo-5.93.0/src/lib/baloosettings.kcfg -->

<kcfgfile name="baloofilerc" />

  <group name="Basic Settings">
    <entry name="indexingEnabled" key="Indexing-Enabled" type="Bool">
      <label>Indexing-Enabled</label>  
      <default>true</default>
    </entry>
  </group>

    <entry name="onlyBasicIndexing" key="only basic indexing" type="Bool">
      <label>only basic indexing</label>
      <default>false</default>
    </entry>
```

EXPECTED
let distributors and users have global config files in /etc/kde/
example: /etc/kde/baloofilerc

config resolution:

1. use the hard-coded settings for "baloofilerc"
2. if /etc/kde/baloofilerc exists, merge settings
3. if $HOME/.config/baloofilerc exists, merge settings

CONTEXT
related downstream issue:
option request: services.baloo.enable
https://github.com/NixOS/nixpkgs/issues/63489

SOFTWARE/OS VERSIONS
KDE Plasma Version: plasma-desktop-5.26.2
KDE Frameworks Version: 
Qt Version:
Comment 1 David Redondo 2023-01-13 12:32:59 UTC
kcfg files are not default config files

kconfig properly respects the $XDG_DATA_DIRS hierachy. I.e. on most distros default config can be provided in /etc/xdg
Comment 2 Milan Hauth 2023-01-13 16:10:01 UTC
i tried

```
balooctl disable
# Disabling and stopping the File Indexer

balooctl status
# Baloo is currently disabled. To enable, please run balooctl enable

rm ~/.config/baloofilerc

sudo mkdir /etc/xdg

sudo cat >/etc/xdg/baloofilerc <<EOF
[Basic Settings]
Indexing-Enabled=false
EOF

balooctl status
# Baloo Index could not be opened
```

expected:
the second `balooctl status` should also say

> Baloo is currently disabled. To enable, please run balooctl enable

i did not try to restart plasma-desktop
but i guess it will ignore /etc/xdg/baloofilerc and start baloo
which is "default on" per baloo-5.93.0/src/lib/baloosettings.kcfg
Comment 3 tagwerk19 2023-01-18 20:40:19 UTC
(In reply to milahu from comment #0)
> CONTEXT
> related downstream issue:
> option request: services.baloo.enable
> https://github.com/NixOS/nixpkgs/issues/63489

(In reply to David Redondo from comment #1)
> kconfig properly respects the $XDG_DATA_DIRS hierachy. I.e. on most distros
> default config can be provided in /etc/xdg

This might be answering a different question (and I'm not deep into Nixos), but this would create an /etc/xdg/baloofilerc file that disables baloo by default if you have it in your configuration.nix

  environment.etc = {
    "xdg/baloofilerc" = {
      text = ''
        [Basic Settings]
        Indexing-Enabled=false
      '';
      mode = "0644";
    };
  };

Alas, don't know what you would do to do it with flakes...