cosmic-epoch icon indicating copy to clipboard operation
cosmic-epoch copied to clipboard

[Question] Config File for Cosmic

Open tudorjnu opened this issue 11 months ago • 6 comments

I love the DE features and I was wondering if it is possible to have a configuration file. I would love to be able to have my desktop configured in this file and then just sync it with my other machines.

I apologise if this issue was raised before, I could not find any references.

tudorjnu avatar Feb 26 '24 08:02 tudorjnu

The various components are (mostly, some are still migrating) using a common configuration system call cosmic-config. All it's config files are stored in .config/cosmic, so you should be able to easily sync that folder.

A notable exceptions (temporarily, eventually everything will use cosmic-config) are the cosmic-comp shortcuts.

Drakulix avatar Feb 26 '24 11:02 Drakulix

I was wondering, could a software similar to dconf could be written with cosmic-config ?

wiiznokes avatar Feb 26 '24 19:02 wiiznokes

I was wondering, could a software similar to dconf could be written with cosmic-config ?

config-config is more like a file-based alternative to dconf. There is a daemon and of course software to inspect the config state could be written, but one of the main goals is to make this also easy to edit manually.

Drakulix avatar Feb 26 '24 20:02 Drakulix

Yes, i like that the config file a text based, but the advantage of dconf is it expose all the settings, even the one that where not edited, witch make it super easy to find somethings.

I guess this leaves 3 alternatives for a possible version of dconf for cosmic

  • generate the config-files entirely (probably not wanted)
  • make a special directory where software can write their default config files, so that dconf could diff the default file with the user file
  • dconf have access to the rust config struct (seems hard)

wiiznokes avatar Feb 26 '24 20:02 wiiznokes

generate the config-files entirely (probably not wanted)

Not really possible. The files already contain every key, that can be set for the most part. But that alone doesn't show you the variants that can be set per key.

make a special directory where software can write their default config files, so that dconf could diff the default file with the user file

Yes the default isn't very accessible right now.

dconf have access to the rust config struct (seems hard)

Easier than you would think. All project separate the configuration parts into a separate crate, so that e.g. the settings application can easily depend on the configuration structs of the other components. You can also easily create default configuration files from there.

Drakulix avatar Feb 26 '24 20:02 Drakulix

I just has a thought that may be a good solution, generate a shema from the config struct. This will have the benefit of keeping away the real code of cosmic-app to support all applets/app.

Link that could help:

  • https://github.com/serde-rs/serde/issues/345
  • https://github.com/oooutlk/reflection
  • https://crates.io/crates/serde-reflection

wiiznokes avatar Mar 20 '24 11:03 wiiznokes