aboutsummaryrefslogtreecommitdiffstats
path: root/static/modules
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-11 10:01:11 +0100
committerDanilo M. <danix@danix.xyz>2026-11-11 10:01:11 +0100
commit79d3be64f0a3e4552b08c80f1678649ccbff2a7c (patch)
tree9f6532b6119a6a71dd08d108bd1527cec6b8ce41 /static/modules
parent978ec811803cdbeb10dc2e6924ab33aa2b84bec6 (diff)
downloaddeck-it-79d3be64f0a3e4552b08c80f1678649ccbff2a7c.tar.gz
deck-it-79d3be64f0a3e4552b08c80f1678649ccbff2a7c.zip
feat(windows): a new window brings the Windows tab forward
When a window id appears that the last poll did not list, the tablet shows the Windows tab for [windows] peek seconds (default 8, 0 off) and then goes back to the tab it was on. A touch on the page or a tab change meanwhile keeps it there; another new window restarts the timer. The hook is generic: a panel's peek(state) returns seconds, app.js does the switching. The first poll only learns what is open, and an error state keeps what it knew, so neither triggers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules')
-rw-r--r--static/modules/windows.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/static/modules/windows.js b/static/modules/windows.js
index 7e2a184..d9f388e 100644
--- a/static/modules/windows.js
+++ b/static/modules/windows.js
@@ -165,6 +165,16 @@ export default {
</div>`;
},
+ // A window that was not there on the last poll brings the tab forward for
+ // [windows] peek seconds.
+ peek(st) {
+ if (!st.windows) return false;
+ const ids = new Set(st.windows.map((w) => w.id));
+ const fresh = this._ids != null && [...ids].some((id) => !this._ids.has(id));
+ this._ids = ids;
+ return fresh ? st.peek ?? 8 : 0;
+ },
+
update(st, el) {
// Polled every second: rebuilding unchanged rows reloads every icon
// through its fallbacks, which flickers, so only a change re-renders.