cosmic-comp/cosmic-comp-config/src/lib.rs
Ian Douglas Scott aa9ec52e62 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.
2023-12-21 09:48:16 +01:00

38 lines
1 KiB
Rust

// SPDX-License-Identifier: GPL-3.0-only
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
pub mod input;
pub mod workspace;
#[derive(Clone, Debug, Default, PartialEq, CosmicConfigEntry)]
pub struct CosmicCompConfig {
pub workspaces: workspace::WorkspaceConfig,
pub input_default: input::InputConfig,
pub input_touchpad: input::InputConfig,
pub input_devices: HashMap<String, input::InputConfig>,
pub xkb_config: XkbConfig,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct XkbConfig {
pub rules: String,
pub model: String,
pub layout: String,
pub variant: String,
pub options: Option<String>,
}
impl Default for XkbConfig {
fn default() -> XkbConfig {
XkbConfig {
rules: String::new(),
model: String::new(),
layout: String::new(),
variant: String::new(),
options: None,
}
}
}