diff --git a/src/config.rs b/src/config.rs index 392bf78..a8cc311 100644 --- a/src/config.rs +++ b/src/config.rs @@ -179,9 +179,6 @@ pub struct GeneralConfig { #[serde(default = "def_one")] pub long_press_duration: f32, - #[serde(default = "def_pw_tokens")] - pub pw_tokens: PwTokenMap, - #[serde(default = "def_osc_port")] pub osc_out_port: u16, diff --git a/src/overlays/screen.rs b/src/overlays/screen.rs index 4602828..948b3a1 100644 --- a/src/overlays/screen.rs +++ b/src/overlays/screen.rs @@ -632,8 +632,9 @@ fn get_pw_token_path() -> PathBuf { } #[cfg(feature = "wayland")] -pub fn save_pw_token_config(tokens: &PwTokenMap) -> Result<(), Box> { - let yaml = serde_yaml::to_string(tokens)?; +pub fn save_pw_token_config(tokens: PwTokenMap) -> Result<(), Box> { + let conf = TokenConf { pw_tokens: tokens }; + let yaml = serde_yaml::to_string(&conf)?; std::fs::write(get_pw_token_path(), yaml)?; Ok(()) @@ -721,7 +722,7 @@ pub fn create_screens_wayland( if pw_tokens_copy != pw_tokens { // Token list changed, re-create token config file - if let Err(err) = save_pw_token_config(&pw_tokens) { + if let Err(err) = save_pw_token_config(pw_tokens) { log::error!("Failed to save Pipewire token config: {}", err); } }