diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-26 09:53:27 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-26 09:53:27 +0200 |
| commit | 161f4ee8fd956b192ec8e028052c2ec98b098852 (patch) | |
| tree | 0e5a440d79a6a617f5e94662cefaae9a2a4ad6d7 /assistant/Place.js | |
| parent | 34eaeeb06ba0e5a831ff1dd17fa199b13e52b965 (diff) | |
| download | quickshell-161f4ee8fd956b192ec8e028052c2ec98b098852.tar.gz quickshell-161f4ee8fd956b192ec8e028052c2ec98b098852.zip | |
feat(assistant): overlay for the voice assistant
Reads desktop-assistant's event socket, JSON lines on a Unix socket the
assistant owns: state, context use, the running tool and audio levels.
A circle shows the name and used/total context, a wrench and the tool
name while one runs, and pulsing dots while it transcribes or thinks.
Around it three sine ripples follow the loudness, the user's voice and
the reply in two palette colours from Theme, so a udt change recolours
them live. It fades out a configurable delay after the reply.
The ripple is driven by FrameAnimation, not a Timer: a 16 ms Timer
drifted against the display refresh and visibly stuttered. Standalone
like the other components; it reconnects every 2 s while the assistant
is down, and the assistant runs the same without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'assistant/Place.js')
| -rw-r--r-- | assistant/Place.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/assistant/Place.js b/assistant/Place.js new file mode 100644 index 0000000..f6d895c --- /dev/null +++ b/assistant/Place.js @@ -0,0 +1,23 @@ +.pragma library +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Top-left corner of a size x size square on a W x H screen, margin away +// from the edges its position names. Anything unknown is the centre. +function at(position, W, H, size, margin) { + const x = position.endsWith("left") ? margin + : position.endsWith("right") ? W - size - margin + : (W - size) / 2; + const y = position.startsWith("top") ? margin + : position.startsWith("bottom") ? H - size - margin + : (H - size) / 2; + return { x, y }; +} |
