From 6933aa3220ff420beeb883d25fc68b9c79aa7df1 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 10:33:13 +0100 Subject: feat: K1C printer tab and proper cards for switched-off sources A K1C tab follows a Klipper printer through Moonraker ([k1c] url): state, file, progress with elapsed, left and finish time, layer, the slicer's model thumbnail, nozzle and bed with target and power, fan, speed, position, filament, and the camera snapshot. It is read-only bar one action, the emergency stop (M112), behind a press-and-hold button so a stray touch on an always-on tablet cannot kill a print. Klipper being down (after a stop) shows its message in a red banner. The printer is often off, so a failed poll backs off 10s instead of costing every tick a timeout. File metadata is fetched once per job; the slicer's estimate covers the start of a print until the file-position estimate settles. The tablet loads the camera and the thumbnail straight from the printer, so both need it on the printer's LAN. OBS, the build VM and LLM usage showed raw text when their source was off ("OBS offline: [Errno 111] ..."). They now share static/offline.js: a greyed app icon, what is off, what brings it back, and a pulsing "checking" note, with the raw error in the tooltip. OBS hides its empty blocks while off. The card is not rebuilt on every poll. Co-Authored-By: Claude Opus 5.5 --- static/modules/obs.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'static/modules/obs.js') diff --git a/static/modules/obs.js b/static/modules/obs.js index 3cc4197..5005ffc 100644 --- a/static/modules/obs.js +++ b/static/modules/obs.js @@ -17,6 +17,8 @@ // OBS as a stream-deck tab: icon-forward buttons and volume sliders, sized // for a finger rather than a mouse. +import { offline } from "../offline.js"; + const ICONS = { record: '', stream: '', @@ -154,11 +156,16 @@ export default { update(state, el) { const transport = el.querySelector(".deck-transport"); + // Off, the empty Scenes/Audio/Sources/Transition blocks would only be + // headings, so they go and the card says what brings OBS back. + for (const cols of el.querySelectorAll(".deck-cols")) cols.hidden = !state.connected; if (!state.connected) { - transport.innerHTML = `
${state.error ? `OBS offline: ${state.error}` : "OBS offline"}
`; - for (const box of el.querySelectorAll(".scenes, .sources, .mixer, .transitions")) { - box.textContent = ""; - } + offline(transport, { + icon: "/icons/com.obsproject.Studio.svg", + title: "OBS is not running", + detail: "Start OBS and its scenes, sources and audio appear here.", + reason: state.error, + }); return; } renderTransport(transport, state); -- cgit v1.2.3