cosmic: Provide CosmicConfigEntry impl, use _ in property names

It seems to derive `CosmicConfigEntry`, we need to use `_` in property
names, because `_` isn't mapped to `-` and there doesn't seem to be a
mechanism like `#[serde(rename)]`.

It seems good to be consistent anyway. So this seems good to change,
unless we really like using `-` for names on disk, then cosmic-panel
needs to be changed.

`CosmicConfigEntry` also requires `PartialEq`, which is easy enough to
add.

This will break existing input settings, which will have to be
re-applied with the new locations. Cosmic-settings also need to be
updated for this.
This commit is contained in:
Ian Douglas Scott 2023-12-20 16:52:44 -08:00 committed by Victoria Brekenfeld
parent d4d51192b5
commit aa9ec52e62
6 changed files with 30 additions and 17 deletions

View file

@ -175,10 +175,10 @@ impl Config {
Config {
static_conf: Self::load_static(xdg.as_ref(), workspace.workspace_layout),
dynamic_conf: Self::load_dynamic(xdg.as_ref()),
xkb: get_config(&config, "xkb-config"),
input_default: get_config(&config, "input-default"),
input_touchpad: get_config(&config, "input-touchpad"),
input_devices: get_config(&config, "input-devices"),
xkb: get_config(&config, "xkb_config"),
input_default: get_config(&config, "input_default"),
input_touchpad: get_config(&config, "input_touchpad"),
input_devices: get_config(&config, "input_devices"),
workspace,
config,
}
@ -517,18 +517,18 @@ fn config_changed(config: cosmic_config::Config, keys: Vec<String>, state: &mut
}
state.common.config.xkb = value;
}
"input-default" => {
let value = get_config::<InputConfig>(&config, "input-default");
"input_default" => {
let value = get_config::<InputConfig>(&config, "input_default");
state.common.config.input_default = value;
update_input(state);
}
"input-touchpad" => {
let value = get_config::<InputConfig>(&config, "input-touchpad");
"input_touchpad" => {
let value = get_config::<InputConfig>(&config, "input_touchpad");
state.common.config.input_touchpad = value;
update_input(state);
}
"input-devices" => {
let value = get_config::<HashMap<String, InputConfig>>(&config, "input-devices");
"input_devices" => {
let value = get_config::<HashMap<String, InputConfig>>(&config, "input_devices");
state.common.config.input_devices = value;
update_input(state);
}