From ec140125f208d5f6e507dfe6b8e9abc7236cb21b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 16:25:12 +0100 Subject: feat(assistant): a faint picture behind the Assistant tab `[assistant] background` names an image (none by default); the server serves it at /api/bg behind the token, and the tab shows its subject from the right side, desaturated and faded out on every side so no edge shows: opacity .24 while the chat is empty, .07 during a conversation. Tuned on the 1280x800 tablet. Co-Authored-By: Claude Opus 5.5 --- config.toml | 3 +++ deckit/server.py | 13 +++++++++++++ static/deck.css | 16 ++++++++++++++++ static/modules/assistant.js | 2 ++ tests/test_server.py | 12 ++++++++++++ 5 files changed, 46 insertions(+) diff --git a/config.toml b/config.toml index 2906efe..57a0ce8 100644 --- a/config.toml +++ b/config.toml @@ -74,6 +74,9 @@ url = "" # keystone's desktop shell, the quickshell config whose `assistant catalog` # IPC call lists the canvas's Ask presets and Do ops for the tab. shell = "~/Programming/GIT/quickshell/desktop" +# An image blended faintly into the Assistant tab's background, its subject +# rising from the bottom-right corner. Empty: none. +background = "" [windows] # Workspaces shown on the Windows tab, including empty ones. diff --git a/deckit/server.py b/deckit/server.py index 835b612..19edbef 100644 --- a/deckit/server.py +++ b/deckit/server.py @@ -108,6 +108,16 @@ def art(): return None +def background(): + """The Assistant tab's backdrop, `[assistant] background`; None when unset.""" + name = CFG.get("assistant", {}).get("background", "") + path = Path(name).expanduser() + try: + return (path.read_bytes(), mimetypes.guess_type(path)[0] or "image/jpeg") if name else None + except OSError: + return None + + _font = {} @@ -194,6 +204,9 @@ class Handler(BaseHTTPRequestHandler): if len(parts) == 2 and parts[1] == "art": image = art() return self._send(200, image[0], image[1], cache=True) if image else self._send(404) + if len(parts) == 2 and parts[1] == "bg": + image = background() + return self._send(200, image[0], image[1], cache=True) if image else self._send(404) if len(parts) == 2 and parts[1] == "modules": return self._json(REGISTRY.names()) if len(parts) == 2: diff --git a/static/deck.css b/static/deck.css index d998af4..3c45e98 100644 --- a/static/deck.css +++ b/static/deck.css @@ -686,3 +686,19 @@ select { } #asleep[hidden] { display: none; } .asleep-moon { font-size: 3rem; color: var(--udt-overlay0); } + +/* The Assistant tab's backdrop ([assistant] background, served at /api/bg): + the picture's subject rising from the bottom-right corner, desaturated + and faded out toward the content; stronger while the chat is empty. No + image configured: the URL answers 404 and nothing shows. */ +.assistant { position: relative; } +.assistant::before { + content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; + /* ponytail: sized for the 1280x800 tablet; the subject centre sits ~74% across */ + background: url("/api/bg") no-repeat right -300px top / auto 108%; + filter: saturate(.75) brightness(.9); + opacity: .07; transition: opacity .6s; + mask-image: radial-gradient(ellipse 27% 56% at 74% 40%, #000 30%, transparent 100%); +} +.assistant.idle::before { opacity: .24; } +.assistant > * { position: relative; z-index: 1; } diff --git a/static/modules/assistant.js b/static/modules/assistant.js index 99df15b..257fb2e 100644 --- a/static/modules/assistant.js +++ b/static/modules/assistant.js @@ -316,6 +316,8 @@ export default { off._offline = null; el._busy = !!st.pending || st.state !== "idle"; + // The backdrop shows more while the chat is empty. + el.querySelector(".assistant").classList.toggle("idle", !st.turns.length && !st.pending); const model = el.querySelector(".as-model"); const cloud = st.models.some((m) => m.cloud && m.id === st.wanted); model.querySelector("i").textContent = cloud ? G.cloud : ""; diff --git a/tests/test_server.py b/tests/test_server.py index d37723e..054b3a6 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -102,6 +102,18 @@ class Server(unittest.TestCase): conn.close() self.assertEqual(r.getheader("X-Deckit-Sleep"), "1") + def test_background_follows_the_config(self): + from unittest import mock + import tempfile + from pathlib import Path + f = Path(tempfile.mkdtemp()) / "bg.jpg" + f.write_bytes(b"\xff\xd8jpeg") + with mock.patch.dict(srv.CFG, {"assistant": {"background": str(f)}}): + self.assertEqual(self.req("GET", "/api/bg", HOST), (200, b"\xff\xd8jpeg")) + self.assertEqual(self.req("GET", "/api/bg", {"Host": "127.0.0.1:8765"})[0], 401) + with mock.patch.dict(srv.CFG, {"assistant": {"background": ""}}): + self.assertEqual(self.req("GET", "/api/bg", HOST)[0], 404) + def test_nerd_font(self): from unittest import mock import tempfile -- cgit v1.2.3