fix: apply the roundness to the panel after reset to system defaults

This commit is contained in:
Ashley Wulber 2024-05-03 10:29:15 -04:00 committed by Michael Murphy
parent a5fafed3b1
commit a7d8d73c9f
2 changed files with 14 additions and 4 deletions

View file

@ -698,6 +698,8 @@ impl Page {
tracing::error!("Failed to get the theme config."); tracing::error!("Failed to get the theme config.");
} }
Self::update_panel_radii(self.roundness);
self.reload_theme_mode(); self.reload_theme_mode();
Command::none() Command::none()
} }

View file

@ -1,7 +1,6 @@
use cosmic::{ use cosmic::{
cctk::sctk::reexports::client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy}, cctk::sctk::reexports::client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy},
cosmic_config::{self, Config, CosmicConfigEntry}, cosmic_config::{self, CosmicConfigEntry},
cosmic_theme::{CornerRadii, ThemeBuilder, ThemeMode},
iced::Length, iced::Length,
theme, theme,
widget::{ widget::{
@ -398,13 +397,22 @@ impl PageInner {
Message::ResetPanel => { Message::ResetPanel => {
if let Some((default, config)) = self if let Some((default, config)) = self
.system_default .system_default
.as_ref() .as_mut()
.zip(self.config_helper.as_ref()) .zip(self.config_helper.as_ref())
{ {
self.panel_config = self.system_default.clone(); if default.anchor_gap || !default.expand_to_edges {
let radii = cosmic::theme::system_preference()
.cosmic()
.corner_radii
.radius_xl[0] as u32;
default.border_radius = radii;
} else {
default.border_radius = 0;
}
if let Err(err) = default.write_entry(config) { if let Err(err) = default.write_entry(config) {
tracing::error!(?err, "Error resetting panel config."); tracing::error!(?err, "Error resetting panel config.");
} }
self.panel_config = self.system_default.clone();
} else { } else {
tracing::error!("Panel config default is missing."); tracing::error!("Panel config default is missing.");
} }