ci / check (push) Failing after 3s
- The window has no system decoration: a local title bar webview (agent state, a native menu with the tray's items, window buttons) above the content webview, which stays remote with no IPC. Laid out on resize, with a frame to resize by unless maximized. - Icons from the transparent pixel leaf, not the server's tiled icon. - productName llembas-desktop: package, .desktop file and the window's app id now match (KWin showed a generic icon); the visible name stays LLeMbas through a desktop template. Replaces the 0.1.0 package l-le-mbas. - The bundled CLI is a resource in the app's own directory, not /usr/bin/lembas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
// The title bar. Moving and double-click maximising come from `data-tauri-drag-region`; the
|
|
// buttons call the window directly; the menu and the agent pill open the app's native menu (the
|
|
// tray's items), which can reach past this 36-pixel-high page.
|
|
"use strict"
|
|
|
|
const { invoke } = window.__TAURI__.core
|
|
const { listen } = window.__TAURI__.event
|
|
const win = window.__TAURI__.window.getCurrentWindow()
|
|
|
|
const $ = (id) => document.getElementById(id)
|
|
|
|
const WORDS = {
|
|
off: "agent off",
|
|
not_linked: "not linked",
|
|
starting: "agent starting…",
|
|
running: "agent running",
|
|
elsewhere: "agent running (service)",
|
|
failed: "agent stopped",
|
|
}
|
|
|
|
function render(s) {
|
|
let host = ""
|
|
try {
|
|
host = s.server ? new URL(s.server).host : ""
|
|
} catch {}
|
|
$("host").textContent = host
|
|
$("host").title = s.server || ""
|
|
const state = s.agent.state
|
|
$("agent").dataset.state = state
|
|
$("agent-text").textContent = WORDS[state] ?? state
|
|
$("agent").title = state === "failed" ? `Agent stopped: ${s.agent.detail}` : "Agent"
|
|
}
|
|
|
|
function maximized(on) {
|
|
const b = $("maximize")
|
|
b.toggleAttribute("data-maximized", on)
|
|
b.setAttribute("aria-label", on ? "Restore" : "Maximise")
|
|
b.title = on ? "Restore" : "Maximise"
|
|
}
|
|
|
|
$("minimize").addEventListener("click", () => win.minimize())
|
|
$("maximize").addEventListener("click", () => win.toggleMaximize())
|
|
$("close").addEventListener("click", () => win.close())
|
|
$("menu").addEventListener("click", () => invoke("titlebar_menu"))
|
|
$("agent").addEventListener("click", () => invoke("titlebar_menu"))
|
|
|
|
listen("status", (e) => render(e.payload))
|
|
listen("maximized", (e) => maximized(!!e.payload))
|
|
invoke("get_status").then(render)
|
|
win.isMaximized().then(maximized)
|