// SmartFox launcher UI. // // Everything is laid out on a 1920x1080 design grid scaled by `u`. // The frosted glass surfaces are NOT drawn here: Slint exports their geometry // (`glass-rects` plus the card-row properties) and the Rust OpenGL layer draws // them underneath. Slint only draws text, icons and simple overlays on top. import "fonts/Inter-Regular.ttf"; import "fonts/Inter-Medium.ttf"; import "fonts/Inter-SemiBold.ttf"; import "fonts/InterDisplay-Bold.ttf"; import "fonts/InterDisplay-ExtraBold.ttf"; import { AppIcon, WifiIcon, BluetoothIcon, PlayIcon, InfoIcon } from "icons.slint"; import { PairingGuide } from "pairing.slint"; import { SettingsView, SettingRow } from "settings.slint"; import { KeyboardView } from "keyboard.slint"; export struct AppEntry { id: string, name: string, category: string, description: string, icon: string, accent: color, kind: string, kind-label: string, target: string, } export struct GlassRect { x: length, y: length, w: length, h: length, r: length, focus: float, alpha: float, // Frost (mip level). Negative = nested glass that sits on another pane. blur: float, glow: color, // alpha channel = tint amount tint: color, // Consecutive rects with the same group (> 0) melt together like liquid. group: int, } export component App inherits Window { title: "SmartFox"; background: #050506; default-font-family: "Inter"; preferred-width: 1600px; preferred-height: 900px; forward-focus: keys; // ---- data from Rust ------------------------------------------------- in property <[AppEntry]> apps; in property clock: "21:42"; in property date: "csütörtök, okt. 23."; in property remote-status: "Nincs párosítva"; // Remote pairing guide (state comes from sf-remote). in-out property remote-state; in-out property pairing-open: false; callback pairing-dismissed(); in-out property pairing-skipped: false; out property pair-t: self.pairing-open ? 1 : 0; animate pair-t { duration: 650ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } // Slint draws on top of the glass, so content under a pane must go fully away. out property dim: max(0, 1 - 1.6 * max(self.pair-t, self.set-t)); in-out property toast-text; // Standby (power button): black screen; any key wakes (power.rs). in-out property standby: false; callback wake-requested(); out property standby-t: self.standby ? 1 : 0; animate standby-t { duration: 450ms; easing: ease-in-out; } in-out property toast-shown; // ---- settings screen (rows and actions come from settings_screen.rs) ---- in-out property settings-open: false; in-out property set-area: 0; // 0 = categories, 1 = rows in-out property set-nav: 0; in-out property set-row: 0; in property set-sub: false; // inside a sub page (picker, confirm) in property set-title; in property set-subtitle; in property <[SettingRow]> set-rows; // Keep in sync with the category constants in settings_screen.rs. out property <[string]> set-categories: ["Kijelző", "Távirányító és Bluetooth", "Hálózat", "Energia", "Rendszer"]; out property set-nav-count: self.set-categories.length; callback settings-opened(); callback settings-nav-changed(int); callback settings-activate(int); callback settings-back(); changed set-nav => { root.settings-nav-changed(self.set-nav); } out property set-t: self.settings-open ? 1 : 0; animate set-t { duration: 600ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property nav-pos: self.set-nav; animate nav-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property row-pos: self.set-row; animate row-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property nav-active: (self.settings-open && self.set-area == 0) ? 1 : 0; animate nav-active { duration: 300ms; easing: ease-out; } out property content-active: (self.settings-open && self.set-area == 1) ? 1 : 0; animate content-active { duration: 300ms; easing: ease-out; } // Geometry, mirrored by settings_screen::glass. out property sp-x: 96 * self.u; out property sp-y: 150 * self.u + (1 - self.set-t) * 40 * self.u; out property sp-w: 1728 * self.u; out property sp-h: 870 * self.u; out property nav-x: self.sp-x + 40 * self.u; out property nav-y: self.sp-y + 176 * self.u; out property nav-w: 480 * self.u; out property nav-h: 92 * self.u; out property nav-step: 106 * self.u; out property rows-x: self.sp-x + 576 * self.u; out property rows-y: self.sp-y + 176 * self.u; out property rows-w: self.sp-w - 624 * self.u; out property set-row-h: 88 * self.u; out property set-row-step: 100 * self.u; out property rows-view-h: 600 * self.u; out property rows-scroll: max(0, self.set-row - 5) * self.set-row-step; animate rows-scroll { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } // ---- on-screen keyboard (text and callbacks: keyboard.rs) ---------------- // Opens inside the settings pane; Rust owns the text and validation. in-out property kb-open: false; in property kb-title; in property kb-subtitle; in property kb-text; in property kb-masked; in property kb-placeholder; in property kb-hint; in property kb-hint-error; in property kb-secret; in property kb-can-submit; in property kb-submit-label: "Kész"; in-out property kb-reveal: false; in-out property kb-mode: 0; // abc, ABC, 123, #+= in-out property kb-index: 1; in-out property kb-area: 0; // 0 = keys, 1 = chips in-out property kb-chip: 0; callback kb-type(string); callback kb-delete(); callback kb-clear(); callback kb-submit(); callback kb-closed(); changed kb-open => { if !self.kb-open { root.kb-closed(); } } changed settings-open => { if !self.settings-open { self.kb-open = false; } } out property <[string]> kb-keys: self.kb-mode == 1 ? ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] : self.kb-mode == 2 ? ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", ",", "-", "_", "@", "!", "?", "#", "$", "%", "&", "*"] : self.kb-mode == 3 ? ["+", "=", "/", "\\", ":", ";", "'", "\"", "(", ")", "[", "]", "{", "}", "<", ">", "^", "`", "|", "~"] : ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; out property kb-n: self.kb-keys.length + 2; out property <[string]> kb-chips: [ "abc", "ABC", ".?123", "#+=", self.kb-secret ? (self.kb-reveal ? "Elrejtés" : "Megjelenítés") : "Törlés", self.kb-submit-label, ]; out property kb-t: self.kb-open ? 1 : 0; animate kb-t { duration: 480ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property kb-pos: self.kb-index; animate kb-pos { duration: 200ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property kb-cpos: self.kb-chip; animate kb-cpos { duration: 300ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property kb-keys-active: (self.kb-open && self.kb-area == 0) ? 1 : 0; animate kb-keys-active { duration: 260ms; easing: ease-out; } out property kb-chips-active: (self.kb-open && self.kb-area == 1) ? 1 : 0; animate kb-chips-active { duration: 260ms; easing: ease-out; } // Geometry, mirrored by keyboard::glass. out property kb-field-w: 1300 * self.u; out property kb-field-h: 100 * self.u; out property kb-field-x: self.sp-x + (self.sp-w - self.kb-field-w) / 2; out property kb-field-y: self.sp-y + 210 * self.u; out property kb-key-w: min(58 * self.u, 1600 * self.u / self.kb-n); out property kb-row-x: self.sp-x + (self.sp-w - self.kb-n * self.kb-key-w) / 2; out property kb-row-y: self.sp-y + 410 * self.u; out property kb-row-h: 120 * self.u; out property kb-chip-w: 200 * self.u; out property kb-chip-h: 76 * self.u; out property kb-chip-step: 220 * self.u; out property kb-chip-x: self.sp-x + (self.sp-w - 6 * self.kb-chip-step + 20 * self.u) / 2; out property kb-chip-y: self.sp-y + 600 * self.u; function kb-press-key() { if root.kb-index == 0 { root.kb-type(" "); } else if root.kb-index >= root.kb-n - 1 { root.kb-delete(); } else { root.kb-type(root.kb-keys[root.kb-index - 1]); } } function kb-press-chip() { if root.kb-chip < 4 { root.kb-mode = root.kb-chip; root.kb-index = min(root.kb-index, root.kb-keys.length + 1); root.kb-area = 0; } else if root.kb-chip == 4 { if root.kb-secret { root.kb-reveal = !root.kb-reveal; } else { root.kb-clear(); } } else { root.kb-submit(); } } callback launch(int); callback cancel-launch(); in property launch-detail: "indítása…"; // ---- home grid (tvOS layout; exported so the glass layer can mirror it) ---- // Five icons per row. The first row sits under the top shelf (the backdrop // in the focused app's colours); further rows scroll up and the shelf dims. out property u: min(self.width / 1920, self.height / 1080); out property cols: 5; out property row-x: 90 * self.u; out property row-y: 774 * self.u; out property card-w: 308 * self.u; out property card-h: 185 * self.u; out property card-gap: 50 * self.u; out property row-step: 249 * self.u; out property card-r: 40 * self.u; // Focused icon lift (tvOS-like) and the press-in while OK is held. out property lift: 0.14; out property press-in: 0.06; // ---- focus state ----------------------------------------------------- in-out property focus-index: 0; in-out property sheet-open: false; in-out property launching: false; out property focus-col: Math.mod(self.focus-index, self.cols); out property focus-row: Math.floor(self.focus-index / self.cols); out property focus-x: self.focus-col; animate focus-x { duration: 380ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property focus-y: self.focus-row; animate focus-y { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property row-active: (!self.sheet-open && !self.launching && !self.settings-open) ? 1 : 0; animate row-active { duration: 320ms; easing: ease-out; } // Row 0: the shelf is showing. Deeper rows: the focused row moves to the middle, the row above stays in view. out property grid-scroll: self.focus-row == 0 ? 0 : self.row-y + self.focus-row * self.row-step - 470 * self.u; animate grid-scroll { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property shelf-t: self.focus-row == 0 ? 1 : 0; animate shelf-t { duration: 600ms; easing: ease-in-out; } out property intro: 0; animate intro { duration: 1700ms; easing: ease-out; } // ---- OK: short press opens, long press (hold) shows the context menu ---- in-out property ok-down: false; out property press: (self.ok-down && !self.menu-open) ? 1 : 0; animate press { duration: 160ms; easing: ease-out; } in-out property menu-open: false; in-out property menu-index: 0; out property menu-t: self.menu-open ? 1 : 0; animate menu-t { duration: 460ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); } out property menu-pos: self.menu-index; animate menu-pos { duration: 240ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property <[string]> menu-items: ["Megnyitás", "Részletek"]; hold-timer := Timer { interval: 520ms; running: false; triggered => { self.running = false; if root.ok-down && root.apps.length > 0 && !root.sheet-open && !root.launching && !root.settings-open { root.menu-index = 0; root.menu-open = true; } } } // Context menu geometry: it buds out of the focused icon (merged glass), // above it when there is room, otherwise below. property fc-w: self.card-w * (1 + self.lift); property fc-h: self.card-h * (1 + self.lift); property fc-x: self.row-x + self.focus-col * (self.card-w + self.card-gap) + (self.card-w - self.fc-w) / 2; property fc-y: self.row-y + self.focus-row * self.row-step - self.grid-scroll + (self.card-h - self.fc-h) / 2; out property menu-w: 440 * self.u; out property menu-item-h: 76 * self.u; out property menu-pad: 12 * self.u; property menu-h: self.menu-items.length * self.menu-item-h + 2 * self.menu-pad; property menu-above: self.fc-y - 36 * self.u - self.menu-h > 40 * self.u; property menu-x-end: clamp(self.fc-x, 60 * self.u, self.width - 60 * self.u - self.menu-w); property menu-y-end: self.menu-above ? self.fc-y - 36 * self.u - self.menu-h : self.fc-y + self.fc-h + 36 * self.u; property me: clamp(self.menu-t, 0, 1.2); out property mx: self.fc-x + (self.menu-x-end - self.fc-x) * self.me; out property my: self.fc-y + (self.menu-y-end - self.fc-y) * self.me; out property mw: self.fc-w + (self.menu-w - self.fc-w) * self.me; out property mh: self.fc-h + (self.menu-h - self.fc-h) * self.me; property menu-in: clamp((self.menu-t - 0.45) * 2.5, 0, 1); property toast-t: self.toast-shown ? 1 : 0; animate toast-t { duration: 520ms; easing: cubic-bezier(0.22, 1.25, 0.36, 1); } out property sheet-t: self.sheet-open ? 1 : 0; animate sheet-t { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } out property launch-t: self.launching ? 1 : 0; animate launch-t { duration: 900ms; easing: cubic-bezier(0.72, 0, 0.16, 1); } // Set by Rust once the app window is visible on top. in property app-ready: false; // Launch morph: the focused card's glass grows into a full-screen pane. property le: self.launch-t; property lc-w: self.fc-w; property lc-h: self.fc-h; property lc-x: self.fc-x; property lc-y: self.fc-y; property lm-x: self.lc-x * (1 - self.le); property lm-y: self.lc-y * (1 - self.le); property lm-w: self.lc-w + (self.width - self.lc-w) * self.le; property lm-h: self.lc-h + (self.height - self.lc-h) * self.le; // Splash content appears in the second half of the morph. property splash: clamp((self.le - 0.55) / 0.45, 0, 1); property focused: self.apps.length > 0 ? self.apps[self.focus-index] : { name: "SmartFox" }; property top-in: clamp(self.intro * 2.0 - 0.15, 0, 1); // geometry of the static glass surfaces property capsule-w: 404 * self.u; property capsule-h: 66 * self.u; property capsule-x: 1920 * self.u - 96 * self.u - self.capsule-w; property capsule-y: 50 * self.u; // The toast buds off the status capsule like a droplet (merged glass). property toast-w-end: 620 * self.u; property toast-h-end: 76 * self.u; property toast-e: clamp(self.toast-t, 0, 1.2); property toast-w: self.capsule-w + (self.toast-w-end - self.capsule-w) * clamp(self.toast-e, 0, 1); property toast-h: self.capsule-h + (self.toast-h-end - self.capsule-h) * clamp(self.toast-e, 0, 1); property toast-x: self.capsule-x + self.capsule-w - self.toast-w; property toast-y: self.capsule-y + self.toast-e * (self.capsule-h + 18 * self.u); // Pairing pane and the glass bits inside it (see pairing.slint for the layout). property pane-x: (self.width - 1300 * self.u) / 2; property pane-y: (self.height - 720 * self.u) / 2 + (1 - self.pair-t) * 50 * self.u; property pc-x: self.pane-x + 420 * self.u; property pc-y: self.pane-y + 70 * self.u; property remote-ok: self.remote-state == "paired" || self.remote-state == "connected"; property remote-broken: self.remote-state == "no-adapter"; property pair-in: self.pair-t * self.pair-t; // Launch splash bits. property splash-bar: self.splash * (self.app-ready ? 0 : 1); animate splash-bar { duration: 300ms; } property sheet-w: 700 * self.u; property sheet-x: 1920 * self.u - 64 * self.u - self.sheet-w + (1 - self.sheet-t) * 90 * self.u; property sheet-y: 64 * self.u; property sheet-h: 952 * self.u; // Drawn below the app cards. out property <[GlassRect]> glass-under: [ // Status capsule and the toast that grows out of it (group 1). { x: self.capsule-x, y: self.capsule-y, w: self.capsule-w, h: self.capsule-h, r: self.capsule-h / 2, focus: 0, alpha: self.top-in * (1 - self.launch-t) * (1 - self.sheet-t), blur: 1.2, glow: #ffffff, tint: #ffffff06, group: 1, }, { x: self.toast-x, y: self.toast-y, w: self.toast-w, h: self.toast-h, r: self.toast-h / 2, focus: 0.35, alpha: clamp(self.toast-t * 3, 0, 1) * (1 - self.launch-t), blur: 1.4, glow: self.focused.accent, tint: #ffffff08, group: 1, }, ]; // Context menu, drawn right after the focused card (same group, so it // buds out of the icon like a droplet). Then the selected-item pill. out property <[GlassRect]> glass-menu: [ { x: self.mx, y: self.my, w: self.mw, h: self.mh, r: self.card-r * (1 + self.lift) + (34 * self.u - self.card-r * (1 + self.lift)) * clamp(self.me, 0, 1), focus: 0.12, alpha: clamp(self.menu-t * 3, 0, 1), blur: 3.0, glow: self.focused.accent, tint: #0b0c12.with-alpha(0.42), group: 2, }, { x: self.mx + self.menu-pad, y: self.my + self.menu-pad + self.menu-pos * self.menu-item-h, w: self.mw - 2 * self.menu-pad, h: self.menu-item-h, r: self.menu-item-h / 2, focus: 0.6, alpha: self.menu-in, blur: -1, glow: #ffffff, tint: #ffffff.with-alpha(0.86), }, ]; // Drawn above the app cards. out property <[GlassRect]> glass-over: [ { x: self.lm-x, y: self.lm-y, w: self.lm-w, h: self.lm-h, r: self.card-r * (1 + self.lift) * pow(1 - self.le, 0.7), focus: 1 - 0.7 * self.le, alpha: clamp(self.le * 8, 0, 1), blur: 1.6 + 2.6 * self.le, glow: self.focused.accent, tint: self.focused.accent.darker(0.75).with-alpha(0.10 + 0.55 * self.le), }, // Splash: loading track and the back hint, nested on the full-screen glass. { x: (self.width - 280 * self.u) / 2, y: self.height / 2 + 144 * self.u, w: 280 * self.u, h: 16 * self.u, r: 8 * self.u, focus: 0, alpha: self.splash-bar, blur: -1, glow: self.focused.accent, tint: #00000030, }, { x: (self.width - 440 * self.u) / 2, y: self.height - 112 * self.u, w: 440 * self.u, h: 56 * self.u, r: 28 * self.u, focus: 0, alpha: self.splash, blur: -1, glow: #ffffff, tint: #ffffff08, }, { x: self.pane-x, y: self.pane-y, w: 1300 * self.u, h: 720 * self.u, r: 56 * self.u, focus: 0.2 * self.pair-t, alpha: self.pair-t, blur: 3.8, glow: #ff7a35, tint: #0b0c12.with-alpha(0.48), }, // Pairing: step numbers, live status pill and the skip chip. { x: self.pc-x - 2 * self.u, y: self.pc-y + 152 * self.u, w: 44 * self.u, h: 44 * self.u, r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, glow: #ff7a35, tint: #ff7a3526, }, { x: self.pc-x - 2 * self.u, y: self.pc-y + 228 * self.u, w: 44 * self.u, h: 44 * self.u, r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, glow: #ff7a35, tint: #ff7a3526, }, { x: self.pc-x - 2 * self.u, y: self.pc-y + 332 * self.u, w: 44 * self.u, h: 44 * self.u, r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, glow: #ff7a35, tint: #ff7a3526, }, { x: self.pc-x, y: self.pc-y + 510 * self.u, w: 520 * self.u, h: 64 * self.u, r: 32 * self.u, focus: self.remote-ok ? 0.6 : 0.15, alpha: self.pair-in, blur: -1, glow: self.remote-ok ? #34c759 : self.remote-broken ? #ff9f0a : #ff7a35, tint: self.remote-ok ? #34c75940 : self.remote-broken ? #ff9f0a38 : #ffffff0a, }, { x: self.pc-x + 556 * self.u, y: self.pc-y + 512 * self.u, w: 204 * self.u, h: 60 * self.u, r: 30 * self.u, focus: 0, alpha: self.pair-in, blur: -1, glow: #ffffff, tint: #ffffff06, }, { x: self.sheet-x, y: self.sheet-y, w: self.sheet-w, h: self.sheet-h, r: 44 * self.u, focus: 0.15 * self.sheet-t, alpha: self.sheet-t, blur: 3.4, glow: self.focused.accent, tint: #0a0b10.with-alpha(0.34), }, // Sheet: icon tile, info rows and the back chip, nested on the sheet. { x: self.sheet-x + 40 * self.u, y: self.sheet-y + 48 * self.u, w: 120 * self.u, h: 120 * self.u, r: 34 * self.u, focus: 0.25, alpha: self.sheet-t, blur: -1, glow: self.focused.accent, tint: self.focused.accent.darker(0.6).with-alpha(0.10), }, { x: self.sheet-x + 56 * self.u, y: self.sheet-y + 420 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, }, { x: self.sheet-x + 56 * self.u, y: self.sheet-y + 530 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, }, { x: self.sheet-x + 56 * self.u, y: self.sheet-y + 640 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, }, { x: self.sheet-x + 56 * self.u, y: self.sheet-y + self.sheet-h - 86 * self.u, w: 250 * self.u, h: 56 * self.u, r: 28 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, }, ]; function open-settings() { root.set-area = 0; root.settings-open = true; root.settings-opened(); } function menu-choose() { root.menu-open = false; if root.menu-index == 0 { root.activate(); } else { root.sheet-open = true; } } function activate() { if root.apps.length == 0 { return; } if root.focused.kind == "builtin" { root.open-settings(); } else { root.launching = true; root.launch(root.focus-index); } } keys := FocusScope { key-pressed(event) => { if root.standby { root.wake-requested(); return accept; } if root.kb-open { // Siri Remote: arrows/swipes move, select types, Back (Esc) cancels. // A real keyboard can type directly; Backspace deletes. if event.text == Key.Escape { root.kb-open = false; } else if event.text == Key.Backspace { root.kb-delete(); } else if event.text == Key.Return { if root.kb-area == 0 { root.kb-press-key(); } else { root.kb-press-chip(); } } else if event.text == Key.LeftArrow { if root.kb-area == 0 { root.kb-index = root.kb-index <= 0 ? root.kb-n - 1 : root.kb-index - 1; } else { root.kb-chip = max(0, root.kb-chip - 1); } } else if event.text == Key.RightArrow { if root.kb-area == 0 { root.kb-index = root.kb-index >= root.kb-n - 1 ? 0 : root.kb-index + 1; } else { root.kb-chip = min(5, root.kb-chip + 1); } } else if event.text == Key.DownArrow { if root.kb-area == 0 { root.kb-area = 1; root.kb-chip = root.kb-can-submit ? 5 : root.kb-mode; } } else if event.text == Key.UpArrow { root.kb-area = 0; } else if !event.modifiers.control && !event.modifiers.alt && !event.modifiers.meta { root.kb-type(event.text); } return accept; } if root.pairing-open { if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return { root.pairing-open = false; root.pairing-skipped = true; root.pairing-dismissed(); } return accept; } if root.launching { if event.text == Key.Escape || event.text == Key.Backspace { root.launching = false; root.cancel-launch(); } return accept; } if root.settings-open { let back = event.text == Key.Escape || event.text == Key.Backspace; let ok = event.text == Key.Return || event.text == " "; if root.set-area == 0 { if event.text == Key.UpArrow { root.set-nav = max(0, root.set-nav - 1); } else if event.text == Key.DownArrow { root.set-nav = min(root.set-nav-count - 1, root.set-nav + 1); } else if ok || event.text == Key.RightArrow { root.set-area = 1; root.set-row = 0; } else if back { root.settings-open = false; } } else { if event.text == Key.UpArrow { root.set-row = max(0, root.set-row - 1); } else if event.text == Key.DownArrow { root.set-row = min(root.set-rows.length - 1, root.set-row + 1); } else if ok { root.settings-activate(root.set-row); } else if back || event.text == Key.LeftArrow { if root.set-sub { root.settings-back(); } else { root.set-area = 0; } } } return accept; } if root.sheet-open { if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return { root.sheet-open = false; } return accept; } let ok = event.text == Key.Return || event.text == " "; if root.menu-open { if event.text == Key.UpArrow { root.menu-index = max(0, root.menu-index - 1); } else if event.text == Key.DownArrow { root.menu-index = min(root.menu-items.length - 1, root.menu-index + 1); } else if ok && !event.repeat && !root.ok-down { root.menu-choose(); } else if event.text == Key.Escape || event.text == Key.Backspace { root.menu-open = false; } return accept; } // Grid: arrows move focus, OK acts on release (short) or after a hold (menu). if event.text == Key.LeftArrow { if root.focus-col > 0 { root.focus-index -= 1; } } else if event.text == Key.RightArrow { if root.focus-col < root.cols - 1 && root.focus-index < root.apps.length - 1 { root.focus-index += 1; } } else if event.text == Key.DownArrow { if root.focus-index + root.cols < root.apps.length { root.focus-index += root.cols; } else if (root.focus-row + 1) * root.cols < root.apps.length { root.focus-index = root.apps.length - 1; } } else if event.text == Key.UpArrow { if root.focus-row > 0 { root.focus-index -= root.cols; } } else if event.text == Key.Escape || event.text == Key.Backspace { // Back from a lower row jumps to the top (like tvOS). if root.focus-row > 0 { root.focus-index = root.focus-col; } } else if ok && !event.repeat { root.ok-down = true; hold-timer.running = false; hold-timer.running = true; } accept } key-released(event) => { if (event.text == Key.Return || event.text == " ") && root.ok-down { root.ok-down = false; // Released before the hold timer fired: a normal click. if hold-timer.running { hold-timer.running = false; if !root.menu-open && !root.sheet-open && !root.launching && !root.settings-open { root.activate(); } } return accept; } reject } } init => { root.intro = 1; keys.focus(); } // ---- status capsule --------------------------------------------------- Rectangle { x: root.capsule-x; y: root.capsule-y; width: root.capsule-w; height: root.capsule-h; opacity: root.top-in * (1 - root.launch-t) * (1 - root.sheet-t); WifiIcon { x: 28 * root.u; y: (parent.height - self.height) / 2; width: 30 * root.u; height: 30 * root.u; } BluetoothIcon { x: 70 * root.u; y: (parent.height - self.height) / 2; width: 30 * root.u; height: 30 * root.u; ink: #ffffffb0; } Rectangle { x: 118 * root.u; y: 18 * root.u; width: 1.5 * root.u; height: parent.height - 36 * root.u; background: #ffffff38; } Text { x: 138 * root.u; width: parent.width - 138 * root.u - 30 * root.u; height: parent.height; vertical-alignment: center; text: root.date; font-size: 21 * root.u; color: #ffffffb8; } Text { width: parent.width - 30 * root.u; height: parent.height; vertical-alignment: center; horizontal-alignment: right; text: root.clock; font-size: 28 * root.u; font-weight: 600; color: #ffffff; } } // ---- app grid (no names: tvOS-like icons only) --------------------------- for app[i] in root.apps: Rectangle { // Keep these formulas in sync with `card_rects` in src/main.rs. property gc: Math.mod(i, root.cols); property gr: Math.floor(i / root.cols); property f: max(0, 1 - abs(root.focus-x - self.gc)) * max(0, 1 - abs(root.focus-y - self.gr)) * root.row-active; property s: 1 + (root.lift - root.press-in * root.press) * self.f; property appear: clamp(root.intro * 2.2 - self.gc * 0.12 - self.gr * 0.2 - 0.4, 0, 1); property others: i == root.focus-index ? 1 : 1 - 0.55 * clamp(root.menu-t, 0, 1); // Slint draws above the glass, so icons under the menu must go away entirely. property under-menu: i != root.focus-index && self.x < root.menu-x-end + root.menu-w && self.x + self.width > root.menu-x-end && self.y < root.menu-y-end + root.menu-h && self.y + self.height > root.menu-y-end; property covered: self.under-menu ? clamp(root.menu-t * 2, 0, 1) : 0; width: root.card-w * self.s; height: root.card-h * self.s; x: root.row-x + self.gc * (root.card-w + root.card-gap) + (root.card-w - self.width) / 2; y: root.row-y + self.gr * root.row-step - root.grid-scroll + (root.card-h - self.height) / 2 + (1 - self.appear) * 60 * root.u; opacity: self.appear * self.others * (1 - self.covered) * (1 - root.launch-t) * (1 - root.sheet-t) * root.dim; AppIcon { icon: app.icon; width: 92 * root.u * parent.s; height: self.width; x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2; } } // ---- context menu (long press on OK) ------------------------------------- if root.menu-t > 0.001: Rectangle { x: root.mx; y: root.my; width: root.mw; height: root.mh; opacity: root.menu-in; for item[k] in root.menu-items: Rectangle { property sel: max(0, 1 - abs(root.menu-pos - k)); property ink: self.sel > 0.5 ? #101114 : #ffffff; x: root.menu-pad; y: root.menu-pad + k * root.menu-item-h; width: parent.width - 2 * root.menu-pad; height: root.menu-item-h; if k == 0: PlayIcon { x: 30 * root.u; y: (parent.height - self.height) / 2; width: 26 * root.u; height: 26 * root.u; ink: parent.ink; } if k == 1: InfoIcon { x: 29 * root.u; y: (parent.height - self.height) / 2; width: 28 * root.u; height: 28 * root.u; ink: parent.ink; } Text { x: 80 * root.u; width: parent.width - 100 * root.u; height: parent.height; vertical-alignment: center; text: item; color: parent.ink; font-size: 27 * root.u; font-weight: 600; } } } // ---- details / settings sheet --------------------------------------- Rectangle { x: root.sheet-x; y: root.sheet-y; width: root.sheet-w; height: root.sheet-h; opacity: root.sheet-t; AppIcon { x: 56 * root.u; y: 64 * root.u; width: 88 * root.u; height: 88 * root.u; icon: root.focused.icon; } Text { x: 56 * root.u; y: 176 * root.u; text: root.focused.name; font-family: "Inter Display"; font-weight: 800; font-size: 64 * root.u; letter-spacing: -2 * root.u; color: #ffffff; } Text { x: 56 * root.u; y: 262 * root.u; width: parent.width - 112 * root.u; text: root.focused.description; wrap: word-wrap; font-size: 24 * root.u; color: #ffffffbb; } VerticalLayout { x: 56 * root.u; y: 420 * root.u; width: parent.width - 112 * root.u; spacing: 18 * root.u; for row in [ { k: "Típus", v: root.focused.kind-label }, { k: root.focused.kind == "web" ? (root.focused.id == "netflex" ? "Szerver" : "Cím") : "Parancs", v: root.focused.target }, { k: "Azonosító", v: root.focused.id }, ]: Rectangle { height: 92 * root.u; Text { x: 28 * root.u; y: 16 * root.u; text: row.k; font-size: 19 * root.u; font-weight: 600; color: #ffffff80; } Text { x: 28 * root.u; y: 44 * root.u; width: parent.width - 56 * root.u; text: row.v; font-size: 25 * root.u; color: #ffffff; overflow: elide; } } } Text { x: 56 * root.u; y: parent.height - 86 * root.u; width: 250 * root.u; height: 56 * root.u; horizontal-alignment: center; vertical-alignment: center; text: "‹ Vissza · Esc"; font-size: 21 * root.u; font-weight: 500; color: #ffffffc0; } } // ---- settings screen ------------------------------------------------------ if root.set-t > 0.001 && root.kb-t < 0.999: SettingsView { width: 100%; height: 100%; opacity: root.set-t * (1 - root.kb-t); u: root.u; pane-x: root.sp-x; pane-y: root.sp-y; pane-h: root.sp-h; nav-x: root.nav-x; nav-y: root.nav-y; nav-w: root.nav-w; nav-h: root.nav-h; nav-step: root.nav-step; rows-x: root.rows-x; rows-y: root.rows-y; rows-w: root.rows-w; row-h: root.set-row-h; row-step: root.set-row-step; rows-view-h: root.rows-view-h; rows-scroll: root.rows-scroll; nav-pos: root.nav-pos; nav-active: root.nav-active; row-pos: root.row-pos; content-active: root.content-active; title: root.set-title; subtitle: root.set-subtitle; rows: root.set-rows; categories: root.set-categories; } // ---- on-screen keyboard --------------------------------------------------------- if root.kb-t > 0.001: KeyboardView { width: 100%; height: 100%; opacity: root.kb-t * root.set-t; u: root.u; pane-x: root.sp-x; pane-y: root.sp-y; pane-w: root.sp-w; pane-h: root.sp-h; back-x: root.nav-x; field-x: root.kb-field-x; field-y: root.kb-field-y; field-w: root.kb-field-w; field-h: root.kb-field-h; row-x: root.kb-row-x; row-y: root.kb-row-y; row-h: root.kb-row-h; key-w: root.kb-key-w; chip-x: root.kb-chip-x; chip-y: root.kb-chip-y; chip-w: root.kb-chip-w; chip-h: root.kb-chip-h; chip-step: root.kb-chip-step; keys: root.kb-keys; chips: root.kb-chips; mode: root.kb-mode; pos: root.kb-pos; cpos: root.kb-cpos; keys-active: root.kb-keys-active; chips-active: root.kb-chips-active; title: root.kb-title; subtitle: root.kb-subtitle; shown-text: (root.kb-secret && !root.kb-reveal) ? root.kb-masked : root.kb-text; placeholder: root.kb-placeholder; hint: root.kb-hint; hint-error: root.kb-hint-error; can-submit: root.kb-can-submit; } // ---- remote pairing guide ------------------------------------------------- if root.pair-t > 0.001: PairingGuide { x: root.pane-x; y: root.pane-y; width: 1300 * root.u; height: 720 * root.u; u: root.u; state: root.remote-state; opacity: root.pair-t; } // ---- launch splash ------------------------------------------------------- if root.launch-t > 0.001: Rectangle { width: 100%; height: 100%; // The app icon flies from its card to the center and grows. AppIcon { property size: (92 * (1 + root.lift) + 90 * root.le) * root.u; property cx: (root.lc-x + root.lc-w / 2) * (1 - root.le) + (parent.width / 2) * root.le; property cy: (root.lc-y + root.lc-h / 2) * (1 - root.le) + (parent.height / 2 - 50 * root.u) * root.le; icon: root.focused.icon; width: self.size; height: self.size; x: self.cx - self.size / 2; y: self.cy - self.size / 2; } Text { y: parent.height / 2 + 70 * root.u + (1 - root.splash) * 20 * root.u; width: parent.width; horizontal-alignment: center; text: root.focused.name; font-family: "Inter Display"; font-weight: 800; font-size: 44 * root.u; letter-spacing: -1.2 * root.u; color: #ffffff; opacity: root.splash; } // Indeterminate shimmer while the app loads (inside the glass track). Rectangle { property phase: mod(animation-tick() / 1400ms, 1); x: (parent.width - self.width) / 2; y: parent.height / 2 + 149 * root.u; width: 264 * root.u; height: 6 * root.u; border-radius: self.height / 2; clip: true; opacity: root.splash-bar; Rectangle { x: (parent.width + self.width) * parent.phase - self.width; width: 90 * root.u; height: parent.height; border-radius: self.height / 2; background: @linear-gradient(90deg, #ffffff00 0%, root.focused.accent.brighter(0.6) 50%, #ffffff00 100%); } } Text { y: parent.height - 112 * root.u; width: parent.width; height: 56 * root.u; horizontal-alignment: center; vertical-alignment: center; text: "‹ Bezárás és vissza · Esc"; font-size: 21 * root.u; font-weight: 500; color: #ffffffc0; opacity: root.splash; } } // ---- toast --------------------------------------------------------- Rectangle { x: root.toast-x; y: root.toast-y; width: root.toast-w; height: root.toast-h; opacity: clamp((root.toast-t - 0.55) * 2.5, 0, 1); Rectangle { x: 26 * root.u; y: (parent.height - self.height) / 2; width: 14 * root.u; height: 14 * root.u; border-radius: self.width / 2; background: root.focused.accent.brighter(0.3); } Text { x: 56 * root.u; width: parent.width - 82 * root.u; height: parent.height; vertical-alignment: center; text: root.toast-text; font-size: 24 * root.u; font-weight: 500; color: #ffffff; overflow: elide; } } // ---- standby ------------------------------------------------------------- if root.standby-t > 0.001: Rectangle { width: 100%; height: 100%; background: #000000; opacity: root.standby-t; // Only seen if the TV signal stays on (or in dev mode). Text { width: 100%; height: 100%; horizontal-alignment: center; vertical-alignment: center; text: "Készenlét · nyomj meg egy gombot"; font-size: 22 * root.u; color: #ffffff30; } } }