diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c7a42..52dde1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,25 @@ All notable changes to Lilt are documented here. The format follows ## [Unreleased] +## [0.4.8] - 2026-11-17 + +### Added + +- An auto-hide option that tucks the island away above the top edge and reveals it when + the pointer reaches the top centre of the screen, with a smooth slide and fade. + +### Changed + +- Each appearance keeps its own heading face, chosen to stay legible: Midnight uses Space + Grotesk, Smoked Glass uses Newsreader italic and Liquid Glass uses Unbounded. Settings + section headers use a clean tracked label so the display face is reserved for prominent + titles. + +### Fixed + +- The settings window no longer resizes or overlaps its content when the Appearance page + opens; it stays wide enough for the appearance cards. + ## [0.4.7] - 2026-11-16 ### Added diff --git a/Cargo.lock b/Cargo.lock index a1bebbb..6c47db8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2208,7 +2208,7 @@ dependencies = [ [[package]] name = "lilt" -version = "0.4.7" +version = "0.4.8" dependencies = [ "embed-resource", "image", diff --git a/Cargo.toml b/Cargo.toml index 1836ed0..e6093a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lilt" -version = "0.4.7" +version = "0.4.8" edition = "2024" rust-version = "1.88" description = "A lightweight Dynamic Island-style desktop companion for Windows." diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md index 014a866..9c9b578 100644 --- a/THIRD-PARTY-NOTICES.md +++ b/THIRD-PARTY-NOTICES.md @@ -33,10 +33,10 @@ fonts come unmodified from the [Google Fonts repository](https://github.com/goog (https://github.com/googlefonts/dm-fonts) - **Space Grotesk**: Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk) -- **Instrument Serif**: Copyright 2022 The Instrument Serif Project Authors - (https://github.com/Instrument/instrument-serif) -- **Allura**: Copyright 2010 The Allura Project Authors - (https://github.com/googlefonts/allura) +- **Newsreader**: Copyright 2020 The Newsreader Project Authors + (https://github.com/productiontype/Newsreader) +- **Unbounded**: Copyright 2022 The Unbounded Project Authors + (https://github.com/googlefonts/unbounded) - **JetBrains Mono**: Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) diff --git a/assets/fonts/Allura-Regular.ttf b/assets/fonts/Allura-Regular.ttf deleted file mode 100644 index dd197a2..0000000 Binary files a/assets/fonts/Allura-Regular.ttf and /dev/null differ diff --git a/assets/fonts/InstrumentSerif-Regular.ttf b/assets/fonts/InstrumentSerif-Regular.ttf deleted file mode 100644 index 36fac00..0000000 Binary files a/assets/fonts/InstrumentSerif-Regular.ttf and /dev/null differ diff --git a/assets/fonts/NewsreaderItalic-Variable.ttf b/assets/fonts/NewsreaderItalic-Variable.ttf new file mode 100644 index 0000000..d258796 Binary files /dev/null and b/assets/fonts/NewsreaderItalic-Variable.ttf differ diff --git a/assets/fonts/OFL-Allura.txt b/assets/fonts/OFL-Newsreader.txt similarity index 97% rename from assets/fonts/OFL-Allura.txt rename to assets/fonts/OFL-Newsreader.txt index 2ad2af9..d2d4f40 100644 --- a/assets/fonts/OFL-Allura.txt +++ b/assets/fonts/OFL-Newsreader.txt @@ -1,4 +1,4 @@ -Copyright 2010 The Allura Project Authors (https://github.com/googlefonts/allura) +Copyright 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader) This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: @@ -90,4 +90,4 @@ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/assets/fonts/OFL-InstrumentSerif.txt b/assets/fonts/OFL-Unbounded.txt similarity index 97% rename from assets/fonts/OFL-InstrumentSerif.txt rename to assets/fonts/OFL-Unbounded.txt index 669ce79..1c7db28 100644 --- a/assets/fonts/OFL-InstrumentSerif.txt +++ b/assets/fonts/OFL-Unbounded.txt @@ -1,4 +1,4 @@ -Copyright 2022 The Instrument Serif Project Authors (https://github.com/Instrument/instrument-serif) +Copyright 2022 The Unbounded Project Authors (https://github.com/googlefonts/unbounded) This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: diff --git a/assets/fonts/Unbounded-Variable.ttf b/assets/fonts/Unbounded-Variable.ttf new file mode 100644 index 0000000..e3c064d Binary files /dev/null and b/assets/fonts/Unbounded-Variable.ttf differ diff --git a/src/app/mod.rs b/src/app/mod.rs index 1f43048..8f179bb 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -16,7 +16,7 @@ use std::rc::{Rc, Weak}; use std::time::Duration; use slint::ComponentHandle; -use windows::Win32::Foundation::{HWND, LPARAM, LRESULT, WPARAM}; +use windows::Win32::Foundation::{HWND, LPARAM, LRESULT, POINT, WPARAM}; use windows::Win32::System::Com::{ COINIT_APARTMENTTHREADED, CoInitializeEx, CoInitializeSecurity, EOAC_NONE, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, @@ -27,7 +27,7 @@ use windows::Win32::UI::Shell::{ QUNS_RUNNING_D3D_FULL_SCREEN, SHAppBarMessage, SHQueryUserNotificationState, }; use windows::Win32::UI::WindowsAndMessaging::{ - PBT_APMPOWERSTATUSCHANGE, PBT_APMRESUMEAUTOMATIC, SPI_SETCLIENTAREAANIMATION, SPI_SETDESKWALLPAPER, + GetCursorPos, PBT_APMPOWERSTATUSCHANGE, PBT_APMRESUMEAUTOMATIC, SPI_SETCLIENTAREAANIMATION, SPI_SETDESKWALLPAPER, SPI_SETWORKAREA, SetForegroundWindow, WM_CLOSE, WM_DISPLAYCHANGE, WM_HOTKEY, WM_POWERBROADCAST, WM_SETTINGCHANGE, WM_TIMECHANGE, }; @@ -47,6 +47,15 @@ use crate::window::{self, Notice, WindowKind, placement}; /// Shell notifications for the app bar registration (full-screen detection). const WM_APP_APPBAR: u32 = window::WM_APP_USER; +/// Cursor poll interval while the island is tucked away for auto-hide. +const PEEK_POLL: Duration = Duration::from_millis(90); +/// Delay before a revealed island tucks itself away again after the pointer leaves it. +const PEEK_HIDE_DELAY: Duration = Duration::from_millis(600); +/// Logical depth, below the island's top edge, of the band that reveals the island. +const PEEK_BAND_HEIGHT: f32 = 52.0; +/// Logical padding on each side of the compact island within the reveal band. +const PEEK_BAND_PAD: f32 = 40.0; + pub struct App { island: Island, tray: Tray, @@ -62,6 +71,12 @@ pub struct App { h24: Cell, collapse_timer: slint::Timer, pointer_inside: Cell, + /// Auto-hide: whether the island is revealed right now despite being tucked away. + auto_hide_revealed: Cell, + /// Polls the cursor while the island is tucked, to reveal it at the top centre. + peek_timer: slint::Timer, + /// Re-tucks the island a short while after the pointer leaves it. + peek_hide_timer: slint::Timer, /// Window that had the focus before the island was expanded, restored on collapse. previous_foreground: Cell>, media: RefCell>, @@ -177,6 +192,9 @@ pub fn run() -> Result<(), slint::PlatformError> { h24: Cell::new(clock::uses_24_hour_clock()), collapse_timer: slint::Timer::default(), pointer_inside: Cell::new(false), + auto_hide_revealed: Cell::new(false), + peek_timer: slint::Timer::default(), + peek_hide_timer: slint::Timer::default(), previous_foreground: Cell::new(None), media: RefCell::new(None), media_state: RefCell::new(None), @@ -422,6 +440,11 @@ impl App { state.set_expanded(expanded); state.set_activity(false); app.collapse_timer.stop(); + // Expanding reveals an auto-hidden island; collapsing lets it tuck away again. + if expanded { + app.auto_hide_revealed.set(true); + } + App::apply_peek(app); App::update_progress_timer(app); App::update_sampling(app); App::update_glass_sampling(app); @@ -439,12 +462,16 @@ impl App { if !app.pointer_inside.get() { App::schedule_collapse(app); } - } else if let Some(previous) = app.previous_foreground.take() - && native.is_some_and(|n| n.is_foreground()) - { - unsafe { - let _ = SetForegroundWindow(previous); + } else { + if let Some(previous) = app.previous_foreground.take() + && native.is_some_and(|n| n.is_foreground()) + { + unsafe { + let _ = SetForegroundWindow(previous); + } } + // After collapsing, tuck away again once the pointer has left. + App::schedule_peek_hide(app); } } @@ -453,8 +480,14 @@ impl App { app.island.global::().set_pointer_inside(inside); if inside { app.collapse_timer.stop(); - } else if app.expanded() { - App::schedule_collapse(app); + // Keep a revealed island out while the pointer rests on it. + app.peek_hide_timer.stop(); + } else { + if app.expanded() { + App::schedule_collapse(app); + } + // The pointer left the island: tuck it away again if auto-hide is on. + App::schedule_peek_hide(app); } } @@ -492,11 +525,111 @@ impl App { if visible { app.place(); } + // Under the cursor, auto-hide starts revealed rather than tucking out of reach. + if app.settings.borrow().general.auto_hide && app.pointer_inside.get() { + app.auto_hide_revealed.set(true); + } + App::apply_peek(app); App::update_progress_timer(app); App::update_sampling(app); App::update_glass_sampling(app); } + /// Re-evaluates whether the island should be tucked away for auto-hide, and starts or + /// stops the cursor poll accordingly. + fn apply_peek(app: &Rc) { + let governed = app.settings.borrow().general.auto_hide && app.island_visible(); + let revealed = !governed || app.expanded() || app.auto_hide_revealed.get(); + let tucked = governed && !revealed; + app.island.global::().set_tucked(tucked); + if tucked { + if !app.peek_timer.running() { + let weak = Rc::downgrade(app); + app.peek_timer.start(slint::TimerMode::Repeated, PEEK_POLL, move || { + if let Some(app) = weak.upgrade() { + App::peek_tick(&app); + } + }); + } + } else { + app.peek_timer.stop(); + } + if !governed { + app.peek_hide_timer.stop(); + app.auto_hide_revealed.set(false); + } + } + + /// Reveals the island when the cursor reaches the band at the top centre. + fn peek_tick(app: &Rc) { + let Some(zone) = app.peek_trigger_zone() else { return }; + let mut point = POINT::default(); + if unsafe { GetCursorPos(&mut point) }.is_err() { + return; + } + if zone.contains(point.x, point.y) { + App::reveal_peek(app); + } + } + + /// Shows a tucked island and arms a fallback that re-tucks it if the pointer never + /// lands on it. + fn reveal_peek(app: &Rc) { + if app.auto_hide_revealed.replace(true) { + return; + } + app.peek_hide_timer.stop(); + App::apply_peek(app); + App::schedule_peek_hide(app); + } + + /// Tucks the island away again and resumes polling the cursor. + fn tuck_peek(app: &Rc) { + app.auto_hide_revealed.set(false); + App::apply_peek(app); + } + + /// Re-tucks the island a short while after the pointer leaves it, unless it is + /// expanded or a field inside is being edited. + fn schedule_peek_hide(app: &Rc) { + if !(app.settings.borrow().general.auto_hide && app.island_visible()) + || app.expanded() + || app.pointer_inside.get() + || app.tasks.busy.get() + || app.clipboard.busy.get() + || app.controls.busy.get() + { + return; + } + let weak = Rc::downgrade(app); + app.peek_hide_timer.start(slint::TimerMode::SingleShot, PEEK_HIDE_DELAY, move || { + if let Some(app) = weak.upgrade() { + App::tuck_peek(&app); + } + }); + } + + /// The band, in physical pixels, that reveals a tucked island: the top centre of the + /// chosen monitor, around where the compact island sits. + fn peek_trigger_zone(&self) -> Option { + let monitors = placement::monitors(); + let settings = self.settings.borrow(); + let monitor = placement::choose(&monitors, settings.position.monitor.as_deref())?; + let scale = monitor.scale; + let half_width = (settings.appearance.compact_width as f32 * scale / 2.0).round() as i32; + let pad = (PEEK_BAND_PAD * scale).round() as i32; + let centre = + monitor.work.left + monitor.work.width() / 2 + (settings.position.offset_x as f32 * scale).round() as i32; + let island_top = monitor.work.top + (settings.position.top_margin as f32 * scale).round() as i32; + Some(placement::Rect { + left: centre - half_width - pad, + right: centre + half_width + pad, + // From the very top edge of the screen down past the compact island. + top: monitor.bounds.top, + bottom: island_top + (PEEK_BAND_HEIGHT * scale).round() as i32, + }) + } + /// Updates the clock text and schedules the next update for the start of the next /// minute. Re-arming per minute keeps the clock aligned after sleep or time changes. fn refresh_clock(app: &Rc) { diff --git a/src/app/preferences.rs b/src/app/preferences.rs index a038476..fb9e3fc 100644 --- a/src/app/preferences.rs +++ b/src/app/preferences.rs @@ -542,6 +542,7 @@ fn to_data(s: &Settings, monitors: &[placement::Monitor]) -> SettingsData { auto_collapse_seconds: s.general.auto_collapse_seconds as i32, collapse_on_outside_click: s.general.collapse_on_outside_click, activity_banners: s.general.activity_banners, + auto_hide: s.general.auto_hide, compact_width: s.appearance.compact_width as i32, expanded_width: s.appearance.expanded_width as i32, motion: motion_index(s.appearance.motion), @@ -591,6 +592,7 @@ fn from_data(d: &SettingsData, monitors: &[placement::Monitor], previous: &Setti s.general.auto_collapse_seconds = d.auto_collapse_seconds.max(0) as u32; s.general.collapse_on_outside_click = d.collapse_on_outside_click; s.general.activity_banners = d.activity_banners; + s.general.auto_hide = d.auto_hide; s.appearance.compact_width = d.compact_width.max(0) as u32; s.appearance.expanded_width = d.expanded_width.max(0) as u32; s.appearance.motion = match d.motion { @@ -647,6 +649,7 @@ mod tests { }]; let mut s = Settings::default(); s.position.monitor = Some(r"\\.\DISPLAY2".into()); + s.general.auto_hide = true; s.ambient.intensity = 35; s.appearance.motion = MotionPreference::Reduced; s.appearance.theme = AppearanceMode::LiquidGlass; diff --git a/src/fonts.rs b/src/fonts.rs index 60360f8..b125b10 100644 --- a/src/fonts.rs +++ b/src/fonts.rs @@ -11,13 +11,13 @@ use std::sync::Arc; use slint::fontique_011::fontique; -/// DM Sans (interface), Space Grotesk (Midnight headings), Instrument Serif (Smoked -/// Glass headings), Allura (Liquid Glass headings) and JetBrains Mono (code). +/// DM Sans (interface), Space Grotesk (Midnight headings), Newsreader (Smoked Glass +/// headings, italic), Unbounded (Liquid Glass headings) and JetBrains Mono (code). const FONTS: [&[u8]; 5] = [ include_bytes!("../assets/fonts/DMSans-Variable.ttf"), include_bytes!("../assets/fonts/SpaceGrotesk-Variable.ttf"), - include_bytes!("../assets/fonts/InstrumentSerif-Regular.ttf"), - include_bytes!("../assets/fonts/Allura-Regular.ttf"), + include_bytes!("../assets/fonts/NewsreaderItalic-Variable.ttf"), + include_bytes!("../assets/fonts/Unbounded-Variable.ttf"), include_bytes!("../assets/fonts/JetBrainsMono-Variable.ttf"), ]; @@ -54,6 +54,6 @@ mod tests { collection.family_name(*family).expect("a family name").to_owned() }) .collect(); - assert_eq!(names, ["DM Sans", "Space Grotesk", "Instrument Serif", "Allura", "JetBrains Mono"]); + assert_eq!(names, ["DM Sans", "Space Grotesk", "Newsreader", "Unbounded", "JetBrains Mono"]); } } diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 9951d11..2af4c0f 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -42,6 +42,9 @@ pub struct General { pub collapse_on_outside_click: bool, /// Briefly show track changes in the compact island. pub activity_banners: bool, + /// Keep the island tucked away, revealing it only when the pointer reaches the top + /// centre of the screen. + pub auto_hide: bool, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] @@ -279,7 +282,13 @@ impl Default for Settings { impl Default for General { fn default() -> Self { - Self { auto_collapse: true, auto_collapse_seconds: 8, collapse_on_outside_click: true, activity_banners: true } + Self { + auto_collapse: true, + auto_collapse_seconds: 8, + collapse_on_outside_click: true, + activity_banners: true, + auto_hide: false, + } } } diff --git a/ui/components/heading.slint b/ui/components/heading.slint index cec5a4d..4f578ac 100644 --- a/ui/components/heading.slint +++ b/ui/components/heading.slint @@ -52,3 +52,15 @@ export component Title inherits Text { font-size: root.size * Theme.title-scale; font-weight: Theme.title-weight; } + +// A small, tracked functional label for settings groups and other utilitarian headers. +// It always uses the interface face, so the appearance's expressive display face stays +// reserved for prominent titles and never lands on a list of technical words. +export component SectionLabel inherits Text { + in property size: Theme.font-sm; + font-family: Theme.font; + font-size: root.size; + font-weight: 600; + letter-spacing: 0.8px; + color: Theme.text-secondary; +} diff --git a/ui/island.slint b/ui/island.slint index 15047c1..0f8cc09 100644 --- a/ui/island.slint +++ b/ui/island.slint @@ -118,9 +118,18 @@ export component Island inherits Window { } } + // How far the island lifts above the top edge when auto-hidden, enough to clear the + // compact pill and its shadow margin. + property tuck-shift: Theme.compact-height + 2 * Theme.margin + 12px; + // Keyboard handling for the whole island. Keys that a field or row inside does not - // use arrive here. + // use arrive here. The whole island slides up and fades out when auto-hidden. keys := FocusScope { + y: AppState.tucked ? -root.tuck-shift : 0px; + opacity: AppState.tucked ? 0 : 1; + animate y { duration: Theme.resize-duration; easing: cubic-bezier(0.32, 0.72, 0, 1); } + animate opacity { duration: Theme.fade-duration; } + key-pressed(event) => { if !AppState.expanded { return reject; diff --git a/ui/settings.slint b/ui/settings.slint index b80b079..e1a9b7a 100644 --- a/ui/settings.slint +++ b/ui/settings.slint @@ -2,7 +2,7 @@ import { Switch, Slider, ComboBox, Button, LineEdit, ScrollView, AboutSlint, Pal import { Theme, AppearanceTokens } from "theme.slint"; import { Icon, Icons } from "components/icon.slint"; import { GlassSheen, GlassRim } from "components/glass.slint"; -import { Heading } from "components/heading.slint"; +import { Heading, SectionLabel } from "components/heading.slint"; // Settings as edited in the window. Converted to and from the Rust settings model. @@ -16,6 +16,7 @@ export struct SettingsData { auto-collapse-seconds: int, collapse-on-outside-click: bool, activity-banners: bool, + auto-hide: bool, compact-width: int, expanded-width: int, // 0 = follow Windows, 1 = reduced, 2 = full @@ -58,11 +59,12 @@ component Section inherits VerticalLayout { spacing: 2px; padding-bottom: 18px; - Heading { + SectionLabel { text: root.title; - size: 15px; - color: Palette.foreground; + size: 13px; + color: Theme.window-text; height: 32px; + vertical-alignment: center; } Rectangle { @@ -476,9 +478,12 @@ component AppearanceCard inherits Rectangle { export component SettingsWindow inherits Window { title: "Lilt Settings"; icon: @image-url("../assets/icons/lilt.png"); - preferred-width: 760px; + preferred-width: 780px; preferred-height: 540px; - min-width: 620px; + // Wide enough that the three Appearance cards (min 150px each, plus the sidebar, + // padding and scrollbar) always fit. A narrower window forced a resize when that + // page opened and let the cards overflow, which read as the window jumping. + min-width: 760px; min-height: 420px; background: Theme.window-background; default-font-family: Theme.font; @@ -594,6 +599,14 @@ export component SettingsWindow inherits Window { toggled => { root.data.activity-banners = self.checked; root.edited(); } } } + Row { + label: "Hide until pointed at"; + description: "Tuck the island away and reveal it when the pointer reaches the top centre of the screen."; + Switch { + checked: root.data.auto-hide; + toggled => { root.data.auto-hide = self.checked; root.edited(); } + } + } Row { label: "Reset all settings"; description: "Restore the defaults. The calendar file choice and shortcut are reset too."; diff --git a/ui/state.slint b/ui/state.slint index a551d7e..c49f947 100644 --- a/ui/state.slint +++ b/ui/state.slint @@ -52,6 +52,9 @@ export global AppState { in property pointer-inside; // The island is shown (not hidden by the user or for a full-screen application). in property on-screen: true; + // Auto-hide: the island is tucked away above the top edge and reveals only when the + // pointer reaches the top centre of the screen. + in property tucked: false; in property update-checking; in property update-available; in property update-message: "Check for updates"; diff --git a/ui/theme.slint b/ui/theme.slint index d44c395..352caee 100644 --- a/ui/theme.slint +++ b/ui/theme.slint @@ -187,13 +187,13 @@ export global Theme { card: #ffffff0a, card-hover: #ffffff12, card-border: #ffffff1a, - // Smoked Glass: Instrument Serif, editorial and understated. - display-font: "Instrument Serif", - display-weight: 400, + // Smoked Glass: Newsreader italic, an editorial masthead. + display-font: "Newsreader", + display-weight: 500, display-scale: 1.3, - title-font: "Instrument Serif", - title-weight: 400, - title-scale: 1.25, + title-font: "Newsreader", + title-weight: 500, + title-scale: 1.2, }; // How opaque the glass tints are over the live blur, 0..1. The application sets them @@ -248,11 +248,11 @@ export global Theme { card: #ffffff0d, card-hover: #ffffff17, card-border: #ffffff21, - // Liquid Glass: Allura, a script, for short headings only; longer titles stay - // in DM Sans so they remain easy to read. - display-font: "Allura", - display-weight: 400, - display-scale: 1.6, + // Liquid Glass: Unbounded, rounded and luminous, for short headings; longer titles + // stay in DM Sans so a wide face never overflows a narrow panel. + display-font: "Unbounded", + display-weight: 500, + display-scale: 0.95, title-font: "DM Sans", title-weight: 600, title-scale: 1.0,