feat: enhance configuration management and UI styling, remove unused theme module
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
mod app;
|
||||
pub mod theme;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -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<AeroColors> =
|
||||
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,
|
||||
},
|
||||
])),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
#![cfg(target_os = "linux")]
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use crate::{AppName, DesktopEntry, DesktopEntrySource, ExecCommand, IconPath};
|
||||
|
||||
Reference in New Issue
Block a user