From 3093bc9124fe1e187cdd2fa39976cc4e60329ff1 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 15 Mar 2026 18:31:22 +0100 Subject: [PATCH] feat: enhance configuration management and UI styling, remove unused theme module --- crates/k-launcher-config/src/lib.rs | 15 ++------ .../k-launcher-os-bridge/src/unix_launcher.rs | 5 ++- crates/k-launcher-ui-egui/src/app.rs | 10 +++--- crates/k-launcher-ui/src/app.rs | 7 +++- crates/k-launcher-ui/src/lib.rs | 1 - crates/k-launcher-ui/src/theme.rs | 35 ------------------- crates/plugins/plugin-apps/src/linux.rs | 2 -- 7 files changed, 14 insertions(+), 61 deletions(-) delete mode 100644 crates/k-launcher-ui/src/theme.rs diff --git a/crates/k-launcher-config/src/lib.rs b/crates/k-launcher-config/src/lib.rs index 154ed23..1225dae 100644 --- a/crates/k-launcher-config/src/lib.rs +++ b/crates/k-launcher-config/src/lib.rs @@ -3,7 +3,7 @@ use serde::Deserialize; // RGBA: [r, g, b, a] where r/g/b are 0–255 as f32, a is 0.0–1.0 pub type Rgba = [f32; 4]; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Default)] #[serde(default)] pub struct Config { pub window: WindowCfg, @@ -12,17 +12,6 @@ pub struct Config { pub plugins: PluginsCfg, } -impl Default for Config { - fn default() -> Self { - Self { - window: WindowCfg::default(), - appearance: AppearanceCfg::default(), - search: SearchCfg::default(), - plugins: PluginsCfg::default(), - } - } -} - #[derive(Debug, Clone, Deserialize)] #[serde(default)] pub struct WindowCfg { @@ -63,7 +52,7 @@ impl Default for AppearanceCfg { fn default() -> Self { Self { background_rgba: [20.0, 20.0, 30.0, 0.9], - border_rgba: [0.0, 183.0, 235.0, 1.0], + border_rgba: [229.0, 125.0, 33.0, 1.0], border_width: 1.0, border_radius: 8.0, search_font_size: 18.0, diff --git a/crates/k-launcher-os-bridge/src/unix_launcher.rs b/crates/k-launcher-os-bridge/src/unix_launcher.rs index 98dc32f..9c67ae7 100644 --- a/crates/k-launcher-os-bridge/src/unix_launcher.rs +++ b/crates/k-launcher-os-bridge/src/unix_launcher.rs @@ -105,10 +105,9 @@ impl AppLauncher for UnixAppLauncher { .args(["-selection", "clipboard"]) .stdin(Stdio::piped()) .spawn() + && let Some(stdin) = child.stdin.as_mut() { - if let Some(stdin) = child.stdin.as_mut() { - let _ = stdin.write_all(val.as_bytes()); - } + let _ = stdin.write_all(val.as_bytes()); } } } diff --git a/crates/k-launcher-ui-egui/src/app.rs b/crates/k-launcher-ui-egui/src/app.rs index 6c80901..391669f 100644 --- a/crates/k-launcher-ui-egui/src/app.rs +++ b/crates/k-launcher-ui-egui/src/app.rs @@ -5,7 +5,7 @@ use k_launcher_kernel::{AppLauncher, SearchEngine, SearchResult}; use k_launcher_os_bridge::WindowConfig; const BG: Color32 = Color32::from_rgba_premultiplied(20, 20, 30, 230); -const BORDER_CYAN: Color32 = Color32::from_rgb(0, 183, 235); +const BORDER_COLOR: Color32 = Color32::from_rgb(229, 125, 33); const SELECTED_BG: Color32 = Color32::from_rgba_premultiplied(0, 100, 140, 180); const DIM_TEXT: Color32 = Color32::from_rgb(180, 185, 200); @@ -71,10 +71,8 @@ impl eframe::App for KLauncherApp { self.selected = (self.selected + 1).min(len - 1); } } - if i.key_pressed(Key::ArrowUp) { - if self.selected > 0 { - self.selected -= 1; - } + if i.key_pressed(Key::ArrowUp) && self.selected > 0 { + self.selected -= 1; } }); @@ -96,7 +94,7 @@ impl eframe::App for KLauncherApp { let frame = egui::Frame::new() .fill(BG) - .stroke(egui::Stroke::new(1.0, BORDER_CYAN)) + .stroke(egui::Stroke::new(1.0, BORDER_COLOR)) .inner_margin(egui::Margin::same(12)) .corner_radius(egui::CornerRadius::same(8)); diff --git a/crates/k-launcher-ui/src/app.rs b/crates/k-launcher-ui/src/app.rs index 4107e99..8294ebd 100644 --- a/crates/k-launcher-ui/src/app.rs +++ b/crates/k-launcher-ui/src/app.rs @@ -112,7 +112,12 @@ fn view(state: &KLauncherApp) -> Element<'_, Message> { .id(INPUT_ID.clone()) .on_input(Message::QueryChanged) .padding(12) - .size(cfg.search_font_size); + .size(cfg.search_font_size) + .style(|theme, _status| { + let mut s = iced::widget::text_input::default(theme, iced::widget::text_input::Status::Active); + s.border = Border { color: Color::TRANSPARENT, width: 0.0, radius: 0.0.into() }; + s + }); let row_radius: f32 = cfg.row_radius; let title_size: f32 = cfg.title_size; diff --git a/crates/k-launcher-ui/src/lib.rs b/crates/k-launcher-ui/src/lib.rs index 82895e1..febc564 100644 --- a/crates/k-launcher-ui/src/lib.rs +++ b/crates/k-launcher-ui/src/lib.rs @@ -1,5 +1,4 @@ mod app; -pub mod theme; use std::sync::Arc; diff --git a/crates/k-launcher-ui/src/theme.rs b/crates/k-launcher-ui/src/theme.rs deleted file mode 100644 index 2330462..0000000 --- a/crates/k-launcher-ui/src/theme.rs +++ /dev/null @@ -1,35 +0,0 @@ -use iced::{ - Color, Gradient, - gradient::{ColorStop, Linear}, -}; - -pub struct AeroColors { - pub glass_bg: Color, - pub gloss_highlight: Gradient, - pub border_cyan: Color, -} - -pub static AERO: std::sync::LazyLock = - std::sync::LazyLock::new(AeroColors::standard); - -impl AeroColors { - pub fn standard() -> Self { - Self { - // Semi-transparent "Aero Glass" base - glass_bg: Color::from_rgba8(255, 255, 255, 0.2), - // Cyan/Blue glow typical of the 2008 era - border_cyan: Color::from_rgb8(0, 183, 235), - // We'll use this for the "shine" effect on buttons - gloss_highlight: Gradient::Linear(Linear::new(0.0).add_stops([ - ColorStop { - color: Color::from_rgba8(255, 255, 255, 0.5), - offset: 0.0, - }, - ColorStop { - color: Color::from_rgba8(255, 255, 255, 0.0), - offset: 1.0, - }, - ])), - } - } -} diff --git a/crates/plugins/plugin-apps/src/linux.rs b/crates/plugins/plugin-apps/src/linux.rs index 55dfce4..801d7ab 100644 --- a/crates/plugins/plugin-apps/src/linux.rs +++ b/crates/plugins/plugin-apps/src/linux.rs @@ -1,5 +1,3 @@ -#![cfg(target_os = "linux")] - use std::path::Path; use crate::{AppName, DesktopEntry, DesktopEntrySource, ExecCommand, IconPath};