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

Please consider switching from ron to toml for config files

Open wiiznokes opened this issue 1 year ago • 4 comments

Config files in COSMIC are plain text so that users can edit them manually.

I think we should consider a more user friendly language for it.

toml has a stable syntax that is well documented. Famous software already use it for configuration like Rust, Helix or Hyprland(at least a little i think).

advantages:

  • popular / great tooling / rust support
  • nested structure scale well horizontally (imo)
  • people know toml in general

In this reddit post, you can see that Toml wins:

1. Toml: 1400
2. Json: 795
3. Yaml: 774
...
6 and last. Ron: 76

wiiznokes avatar Apr 20 '24 22:04 wiiznokes

And also, please consider to not splitting to much config into multiple files, i don't think it's worth for setting that don't change a lot. It help if you want for example read a config from another person, copy paste a config, or just saving that file.

I can't think of a setting in COSMIC that change so often that it need to be separate.

wiiznokes avatar Apr 20 '24 23:04 wiiznokes

toml? oh my god :) there are much nicer options than toml if one really does not want ron.

  • cuddle: https://kdl.dev/
  • dhall: https://dhall-lang.org/

soloturn avatar Apr 21 '24 02:04 soloturn

Cuddle seems ok to me, but it has no support for serde yet so idt it's a possible solution for now.

dhall seems way to complex for COSMIC. Imo, it could be used in particular case, for complex plugin for example, but it shouldn't be used for general configuration management.

I think toml is a good solution for now. It have battle tested rust implementation. And the main complain i saw on internet about toml is that is doesn't fit well for nested struct. But it should be fixed in toml 1.1.0, with support for multi-line table.

Anyway, it's not that hard to change the format in the future, so imo, we should just take the best available solution that currently exist. And that's clearly not ron.

wiiznokes avatar Apr 21 '24 13:04 wiiznokes

we should just take the best available solution that currently exist. And that's clearly not ron.

why? if the intent would be for users to engage the settings UI, human readable config is a niche issue. even then it's not clear at all what the issue with RON is aside from unfamiliarity.

atagen avatar May 03 '24 00:05 atagen

.kdl have 2 derives implementation, and niri use this format.

wiiznokes avatar Sep 28 '24 12:09 wiiznokes

why? if the intent would be for users to engage the settings UI, human readable config is a niche issue. even then it's not clear at all what the issue with RON is aside from unfamiliarity.

Some config options are not available in the UI, and some people prefer to use config files, ex nixos users. So, idt this is a niche issue at all. As for the ron format, you can just compare a kdl and ron file and see for yourself. That being said, the worst thing is the split of fields imo.

wiiznokes avatar Sep 28 '24 12:09 wiiznokes

Some config options are not available in the UI, and some people prefer to use config files, ex nixos users.

well, I wrote a pr for nixos-cosmic and home manager to manage cosmic, binds and per application settings work fine in nix->RON - I daily drive cosmic with it right now.

to answer myself about problems with RON; main problem in general is knowing the schema you are trying to serialise to in advance, else for struct/tuple there can be syntax confusion, and you won't know enum values.. but without docs similar issues would be present in any config lang right now.

So, idt this is a niche issue at all. As for the ron format, you can just compare a kdl and ron file and see for yourself. That being said, the worst thing is the split of fields imo.

kdl looks nice enough, but I suspect one big positive with ron is that it's a direct representation of the data structures present in the rust code, for a codebase that is currently pretty fast moving. it seems fairly pragmatic given the relative minority of us who want to use manual-ish config.

atagen avatar Oct 01 '24 10:10 atagen