feat: theme management

This commit is contained in:
Ashley Wulber 2023-06-09 16:10:20 -04:00 committed by Ashley Wulber
parent 3ec06bef80
commit 76bf6a4519
14 changed files with 213 additions and 42 deletions

View file

@ -52,6 +52,7 @@ enum Message {
WorkspaceUpdate(WorkspacesUpdate),
WorkspacePressed(ObjectId),
WheelScrolled(ScrollDelta),
Theme(Theme),
Errored,
}
@ -69,7 +70,7 @@ impl Application for IcedWorkspacesApplet {
PanelAnchor::Left | PanelAnchor::Right => Layout::Column,
PanelAnchor::Top | PanelAnchor::Bottom => Layout::Row,
},
theme: Default::default(),
theme: applet_helper.theme(),
workspaces: Vec::new(),
workspace_tx: Default::default(),
helper: Default::default(),
@ -124,6 +125,7 @@ impl Application for IcedWorkspacesApplet {
}
}
Message::Errored => {}
Message::Theme(t) => self.theme = t,
}
Command::none()
}
@ -182,6 +184,7 @@ impl Application for IcedWorkspacesApplet {
fn subscription(&self) -> Subscription<Message> {
Subscription::batch(
vec![
self.helper.theme_subscription(0).map(Message::Theme),
workspaces(0).map(|e| Message::WorkspaceUpdate(e.1)),
subscription::events_with(|e, _| match e {
Mouse(mouse::Event::WheelScrolled { delta }) => {