fix: align panel settings changes more closely with design
This commit is contained in:
parent
c8148c8f48
commit
46d8c59e90
1 changed files with 22 additions and 45 deletions
|
|
@ -388,42 +388,32 @@ pub enum Message {
|
||||||
|
|
||||||
impl Page {
|
impl Page {
|
||||||
pub fn update(&mut self, message: Message) {
|
pub fn update(&mut self, message: Message) {
|
||||||
|
let helper = self.config_helper.as_ref().unwrap();
|
||||||
|
let mut panel_config = self.panel_config.as_mut().unwrap();
|
||||||
match message {
|
match message {
|
||||||
Message::AutoHidePanel(enabled) => {
|
Message::AutoHidePanel(enabled) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
if enabled {
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
panel_config.exclusive_zone = false;
|
||||||
|
panel_config.autohide = Some(AutoHide {
|
||||||
panel_config.autohide = enabled.then_some(AutoHide {
|
wait_time: 1000,
|
||||||
wait_time: 1000,
|
transition_time: 200,
|
||||||
transition_time: 200,
|
handle_size: 4,
|
||||||
handle_size: 4,
|
});
|
||||||
});
|
} else {
|
||||||
|
panel_config.exclusive_zone = true;
|
||||||
_ = panel_config.write_entry(helper);
|
panel_config.autohide = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Message::PanelAnchor(anchor) => {
|
Message::PanelAnchor(anchor) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.anchor = anchor;
|
panel_config.anchor = anchor;
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::Output(name) => {
|
Message::Output(name) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.output = match name {
|
panel_config.output = match name {
|
||||||
s if s == fl!("all") => CosmicPanelOuput::All,
|
s if s == fl!("all") => CosmicPanelOuput::All,
|
||||||
_ => CosmicPanelOuput::Name(name),
|
_ => CosmicPanelOuput::Name(name),
|
||||||
};
|
};
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::AnchorGap(enabled) => {
|
Message::AnchorGap(enabled) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.anchor_gap = enabled;
|
panel_config.anchor_gap = enabled;
|
||||||
|
|
||||||
if enabled {
|
if enabled {
|
||||||
|
|
@ -431,40 +421,18 @@ impl Page {
|
||||||
} else {
|
} else {
|
||||||
panel_config.margin = 0;
|
panel_config.margin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::PanelSize(size) => {
|
Message::PanelSize(size) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.size = size;
|
panel_config.size = size;
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::Appearance(a) => {
|
Message::Appearance(a) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.background = a.into();
|
panel_config.background = a.into();
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::ExtendToEdge(enabled) => {
|
Message::ExtendToEdge(enabled) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.expand_to_edges = enabled;
|
panel_config.expand_to_edges = enabled;
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::Opacity(opacity) => {
|
Message::Opacity(opacity) => {
|
||||||
let helper = self.config_helper.as_ref().unwrap();
|
|
||||||
let mut panel_config = self.panel_config.as_mut().unwrap();
|
|
||||||
|
|
||||||
panel_config.opacity = opacity;
|
panel_config.opacity = opacity;
|
||||||
|
|
||||||
_ = panel_config.write_entry(helper);
|
|
||||||
}
|
}
|
||||||
Message::Applets => todo!(),
|
Message::Applets => todo!(),
|
||||||
|
|
||||||
|
|
@ -476,7 +444,16 @@ impl Page {
|
||||||
}
|
}
|
||||||
Message::PanelConfig(c) => {
|
Message::PanelConfig(c) => {
|
||||||
self.panel_config = Some(c);
|
self.panel_config = Some(c);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if panel_config.anchor_gap || !panel_config.expand_to_edges {
|
||||||
|
panel_config.border_radius = 8;
|
||||||
|
} else {
|
||||||
|
panel_config.border_radius = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = panel_config.write_entry(helper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue