From d2acecc25d743b900b8d818d3675cd40836a1929 Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Sun, 5 Jul 2026 07:23:01 -0700 Subject: [PATCH] feat: use new UI in shell --- Cargo.lock | 1 + crates/hearthspace-shell/Cargo.toml | 1 + crates/hearthspace-shell/src/ui.rs | 6 +- crates/hearthspace-shell/src/ui/theme.rs | 71 ------------------------ crates/hearthspace-shell/src/ui/views.rs | 49 +++++++++------- crates/ui-components/src/lib.rs | 46 +++++++++++++++ 6 files changed, 78 insertions(+), 96 deletions(-) delete mode 100644 crates/hearthspace-shell/src/ui/theme.rs diff --git a/Cargo.lock b/Cargo.lock index fe99c51..a5e55ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2340,6 +2340,7 @@ name = "hearthspace-shell" version = "0.1.0" dependencies = [ "hearthspace-common", + "hearthspace-ui-components", "rstest", "tempfile", "tracing", diff --git a/crates/hearthspace-shell/Cargo.toml b/crates/hearthspace-shell/Cargo.toml index 57272ef..6c2617b 100644 --- a/crates/hearthspace-shell/Cargo.toml +++ b/crates/hearthspace-shell/Cargo.toml @@ -7,6 +7,7 @@ license = "Apache-2.0" [dependencies] hearthspace-common = { path = "../hearthspace-common" } +hearthspace-ui-components = { path = "../ui-components" } tracing = "0.1.41" tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } wayland-client = "0.31.14" diff --git a/crates/hearthspace-shell/src/ui.rs b/crates/hearthspace-shell/src/ui.rs index 38e6c97..589d700 100644 --- a/crates/hearthspace-shell/src/ui.rs +++ b/crates/hearthspace-shell/src/ui.rs @@ -15,12 +15,10 @@ mod command_client; mod constants; mod output_watcher; mod state; -mod theme; mod views; use output_watcher::initial_wayland_output_names; use state::ShellState; -use theme::{SHELL_BG, shell_properties}; use views::app_logic; pub fn run() -> Result<(), Box> { @@ -36,8 +34,8 @@ pub fn run() -> Result<(), Box> { let state = ShellState::new(command_socket, output_names); let app = Xilem::new(state, app_logic) - .with_default_properties(shell_properties()) - .with_default_base_color(SHELL_BG); + .with_default_properties(hearthspace_ui_components::hearthspace_light_properties()) + .with_default_base_color(hearthspace_ui_components::APP_BACKGROUND); app.run_in(EventLoop::with_user_event())?; Ok(()) } diff --git a/crates/hearthspace-shell/src/ui/theme.rs b/crates/hearthspace-shell/src/ui/theme.rs deleted file mode 100644 index 130ae2b..0000000 --- a/crates/hearthspace-shell/src/ui/theme.rs +++ /dev/null @@ -1,71 +0,0 @@ -use xilem::{ - Color, - masonry::{ - core::{DefaultProperties, PropertyStack, Selector}, - layout::AsUnit, - properties::{ - Background, BorderColor, BorderWidth, CaretColor, ContentColor, CornerRadius, Padding, - PlaceholderColor, - }, - theme::default_property_set, - widgets::{Button, Label, TextArea, TextInput}, - }, -}; - -use super::constants::LAUNCHER_ITEM_H_PAD; - -/// Window background for the bar and launcher palette. -pub(super) const SHELL_BG: Color = Color::from_rgb8(0xf4, 0xf4, 0xf5); -const SHELL_TEXT: Color = Color::from_rgb8(0x1f, 0x1f, 0x23); -const SHELL_PLACEHOLDER: Color = Color::from_rgb8(0x8a, 0x8a, 0x93); -const BUTTON_HOVER_BG: Color = Color::from_rgb8(0xe4, 0xe4, 0xe7); -const BUTTON_ACTIVE_BG: Color = Color::from_rgb8(0xd4, 0xd4, 0xd8); -const INPUT_BG: Color = Color::from_rgb8(0xff, 0xff, 0xff); -const INPUT_BORDER: Color = Color::from_rgb8(0xd4, 0xd4, 0xd8); -const INPUT_FOCUS_BORDER: Color = Color::from_rgb8(0x3b, 0x7e, 0xe4); - -/// Light theme overrides applied to every shell widget. -pub(super) fn shell_properties() -> DefaultProperties { - let mut properties = default_property_set(); - - properties.insert::(Background::Color(Color::TRANSPARENT)); - properties.insert::(BorderWidth { width: 0.0.px() }); - properties.insert::(CornerRadius { radius: 6.0.px() }); - properties.insert::(ContentColor::new(SHELL_TEXT)); - properties.insert::(Padding::from_vh(8.0.px(), LAUNCHER_ITEM_H_PAD.px())); - { - let mut stack = PropertyStack::new(); - stack.push( - Selector::new().with_hovered(true), - Background::Color(BUTTON_HOVER_BG), - ); - stack.push( - Selector::new().with_active(true), - Background::Color(BUTTON_ACTIVE_BG), - ); - properties.insert_stack::