From 2aa05acb6631356fd13461c4142e412a4b7be63a Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 21 Jan 2026 13:05:15 -0800 Subject: [PATCH] feat: toggle window always on top --- src-tauri/src/config.rs | 6 +++++ src/lib/components/ConfigSidebar.svelte | 30 +++++++++++++++++++++++++ src/lib/components/StatusBar.svelte | 1 + src/lib/stores/config.ts | 2 ++ src/routes/+page.svelte | 9 +++++++- 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index a801550..56b79e1 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -55,6 +55,9 @@ pub struct HikariConfig { #[serde(default = "default_notification_volume")] pub notification_volume: f32, + + #[serde(default)] + pub always_on_top: bool, } impl Default for HikariConfig { @@ -70,6 +73,7 @@ impl Default for HikariConfig { greeting_custom_prompt: None, notifications_enabled: true, notification_volume: 0.7, + always_on_top: false, } } } @@ -109,6 +113,7 @@ mod tests { assert_eq!(config.theme, Theme::Dark); assert!(config.greeting_enabled); assert!(config.greeting_custom_prompt.is_none()); + assert!(!config.always_on_top); } #[test] @@ -124,6 +129,7 @@ mod tests { greeting_custom_prompt: Some("Hello!".to_string()), notifications_enabled: true, notification_volume: 0.7, + always_on_top: true, }; let json = serde_json::to_string(&config).unwrap(); diff --git a/src/lib/components/ConfigSidebar.svelte b/src/lib/components/ConfigSidebar.svelte index 69366aa..5cc911f 100644 --- a/src/lib/components/ConfigSidebar.svelte +++ b/src/lib/components/ConfigSidebar.svelte @@ -1,6 +1,7 @@ @@ -396,6 +405,27 @@ + +
+

+ Window +

+ + +
+ +

Keep the window above other windows

+
+
+

diff --git a/src/lib/components/StatusBar.svelte b/src/lib/components/StatusBar.svelte index 10c5d54..b21e54f 100644 --- a/src/lib/components/StatusBar.svelte +++ b/src/lib/components/StatusBar.svelte @@ -43,6 +43,7 @@ greeting_custom_prompt: null, notifications_enabled: true, notification_volume: 0.5, + always_on_top: false, }); onMount(async () => { diff --git a/src/lib/stores/config.ts b/src/lib/stores/config.ts index 3187e4d..9dd41b3 100644 --- a/src/lib/stores/config.ts +++ b/src/lib/stores/config.ts @@ -14,6 +14,7 @@ export interface HikariConfig { greeting_custom_prompt: string | null; notifications_enabled: boolean; notification_volume: number; + always_on_top: boolean; } const defaultConfig: HikariConfig = { @@ -27,6 +28,7 @@ const defaultConfig: HikariConfig = { greeting_custom_prompt: null, notifications_enabled: true, notification_volume: 0.7, + always_on_top: false, }; function createConfigStore() { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 195de40..de718de 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -4,6 +4,7 @@ import { configStore, applyTheme } from "$lib/stores/config"; import { initNotificationSync, cleanupNotificationSync } from "$lib/stores/notifications"; import { conversationsStore } from "$lib/stores/conversations"; + import { getCurrentWindow } from "@tauri-apps/api/window"; import "$lib/notifications/testNotifications"; import Terminal from "$lib/components/Terminal.svelte"; import InputBar from "$lib/components/InputBar.svelte"; @@ -27,10 +28,16 @@ await initializeTauriListeners(); await configStore.loadConfig(); - // Apply saved theme on startup + // Apply saved settings on startup const config = configStore.getConfig(); applyTheme(config.theme); + // Apply always-on-top setting + if (config.always_on_top) { + const window = getCurrentWindow(); + await window.setAlwaysOnTop(true); + } + // Initialize notification settings sync initNotificationSync(); }