diff options
Diffstat (limited to 'static')
| -rw-r--r-- | static/dashboard.js | 46 | ||||
| -rw-r--r-- | static/deck.css | 39 |
2 files changed, 4 insertions, 81 deletions
diff --git a/static/dashboard.js b/static/dashboard.js index 828d36b..336ce2a 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -15,9 +15,8 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // The Dashboard tab: a top band of chips, music and spending always on, a -// row of chips for one to three busy modules, each opening its full slot, -// and the action icons. The page keeps the -// trend history; the modules' APIs are the existing ones. +// row of chips for one to three busy modules, each opening its full slot. +// The page keeps the trend history; the modules' APIs are the existing ones. import { offline } from "./offline.js"; @@ -103,16 +102,6 @@ function marquee(el) { } } -// A Nerd Font glyph is drawn wider than its advance, so centring the advance -// leaves the drawing off centre; shift it by the difference, measured. -function inkShift(el) { - const cs = getComputedStyle(el); - const ctx = (inkShift.ctx ??= document.createElement("canvas").getContext("2d")); - ctx.font = `${cs.fontSize} ${cs.fontFamily}`; - const m = ctx.measureText(el.textContent); - el.style.transform = `translateX(${(m.width - m.actualBoundingBoxRight + m.actualBoundingBoxLeft) / 2}px)`; -} - const SKELETON = ` <svg class="dash-defs" width="0" height="0" aria-hidden="true"><defs> <linearGradient id="hyline" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="120" y2="0"><stop offset="0" style="stop-color:var(--udt-border-1)"/> @@ -146,8 +135,7 @@ const SKELETON = ` <section class="dash-mid"> <div class="dash-always"><div class="card dash-music"></div><div class="card dash-spend"></div></div> <div class="dash-running" hidden></div> - </section> - <section class="dash-acts"></section>`; + </section>`; export default { // names: the enabled modules; poll(name, seconds, update) and open(tab) @@ -317,33 +305,5 @@ export default { }); }); } - - if (on.has("actions")) poll("actions", 30, (st) => { - const acts = $(".dash-acts"); - const key = (st.actions ?? []).map((a) => a.id).join(","); - if (acts._key === key) return; - acts._key = key; - acts.textContent = ""; - for (const a of st.actions ?? []) { - const b = document.createElement("button"); - b.innerHTML = `<i class="nf"></i>`; - b.firstChild.textContent = a.icon; - document.fonts.ready.then(() => inkShift(b.firstChild)); - b.title = a.label; - b.setAttribute("aria-label", a.label); - b.onclick = async () => { - let ok = false; - try { - ok = (await fetch(`/api/actions/${a.id}`, { - method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" })).ok; - } catch {} - if (!ok) { - b.classList.add("fail"); - setTimeout(() => b.classList.remove("fail"), 1500); - } - }; - acts.append(b); - } - }); }, }; diff --git a/static/deck.css b/static/deck.css index d080d4d..a11583a 100644 --- a/static/deck.css +++ b/static/deck.css @@ -87,16 +87,6 @@ body { .tab-panel[hidden] { display: none; } .tab-content { min-height: 100%; } -@property --border-angle { - syntax: "<angle>"; - initial-value: 0deg; - inherits: false; -} - -@keyframes border-rotate { - to { --border-angle: 360deg; } -} - .section-label { font-size: 0.786rem; text-transform: uppercase; @@ -666,7 +656,7 @@ select { /* The Dashboard: one fixed screen (static/dashboard.js). */ .tab-panel[data-tab="Dashboard"] { height: 100%; box-sizing: border-box; padding-top: 18px; } -.dash { height: 100%; display: grid; grid-template-rows: 25% 1fr 10%; grid-template-columns: minmax(0, 1fr); gap: 10px; } +.dash { height: 100%; display: grid; grid-template-rows: 25% 1fr; grid-template-columns: minmax(0, 1fr); gap: 10px; } .dash [hidden] { display: none !important; } .dash-defs { position: absolute; } @@ -815,33 +805,6 @@ select { .dash .slot:has(.sthumb:not([hidden])) .sic { display: none; } } -/* Action icons, each in Hyprland's rotating border. */ -.dash-acts { display: flex; justify-content: center; align-items: center; gap: 28px; min-height: 0; } -.dash-acts button { position: relative; display: grid; place-items: center; padding: 0; height: 100%; max-height: 64px; aspect-ratio: 1; border-radius: 16px; font-size: 1.7rem; line-height: 1; - background: var(--udt-surface0); border: 0; color: var(--udt-text); } -.dash-acts button.fail { color: var(--udt-red); } -/* The Nerd Font glyphs draw past their advance: dashboard.js shifts each by - the gap between its ink and its advance (inkShift). */ -.dash-acts button i { display: block; line-height: 1; font-style: normal; } -/* The same rotating three-hue gradient Hyprland draws on window borders, - read from ~/.cache/udt/udt-border.lua via /theme.css. */ -.dash-acts button::before { - content: ""; - position: absolute; - inset: 0; - border-radius: inherit; - padding: 2px; - background: linear-gradient(var(--border-angle), - var(--udt-border-1), var(--udt-border-2), var(--udt-border-3), var(--udt-border-1)); - -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); - -webkit-mask-composite: xor; - mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); - mask-composite: exclude; - pointer-events: none; - /* Hyprland: speed 30 * 100 ms, flatlinetwo = linear, style = loop */ - animation: border-rotate 3s linear infinite; -} - /* VMs tab: one column. A running VM is a tile as tall as the tab, its screen filling what the rest leaves; with one running it drops the card look and is the whole tab, with more they stack as cards and the tab |
