aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md11
-rw-r--r--README.md5
-rw-r--r--config.toml3
-rw-r--r--deckit/config.py5
-rw-r--r--deckit/modules/actions.py33
-rw-r--r--static/dashboard.js46
-rw-r--r--static/deck.css39
-rw-r--r--tests/test_actions.py32
-rw-r--r--tests/test_config.py9
9 files changed, 18 insertions, 165 deletions
diff --git a/AGENTS.md b/AGENTS.md
index bbee4bb..0da1307 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -24,7 +24,7 @@ Keep the server dependency-free apart from that one package.
`static/dashboard.js`: one fixed screen with no drag, resize or fold. A top
band of chips (stats, Claude usage from `llm`, tablet battery and Wi-Fi),
music and spending (`llm`) always on, a running row of chips for one to
- three busy modules, and the action icons. A panel that can be running
+ three busy modules. A panel that can be running
exports `busy(state)` and `slot(state, el)` (`k1c.js`, `sbbuilder.js`,
`obs.js`); a slot builds its markup once and then only sets text, so its
scrolling lines are not restarted. The slot, and an optional
@@ -32,15 +32,14 @@ Keep the server dependency-free apart from that one package.
package by package), is drawn into a centred `<dialog closedby="any">` a
tap on its chip opens (a tap outside closes it, a tap inside opens the
tab); the chip copies the slot's `.sic`, `.pct` and `.bar`. Hyprland's border colours (`--udt-border-1..3`) colour
- the trend lines and progress bars and rotate around the action icons.
+ the trend lines and progress bars.
- `stats` also carries `updates`, keystone's "to install" count from
`updatesctl` (`[dashboard] updates`, empty hides it), re-read in a thread
every 5 min so its NFS reads never stall the 1s poll.
-- `actions` serves the Dashboard's icons: `[dashboard] actions`, ids from
- `config.ACTION_IDS`, each a fixed command (`screenshot` runs
- `qar-scrotmenu.sh`, `lock` runs `lock.sh`). Its watcher checks `pidof
+- `actions` has no state and no actions, only a watcher: it checks `pidof
hyprlock` every 2s and sends the tablet `KEYCODE_SLEEP` on lock and
- `KEYCODE_WAKEUP` on unlock, for every lock, not only the button.
+ `KEYCODE_WAKEUP` on unlock. (Its Dashboard icons were dropped; the name
+ stays because keystone's module toggle uses it.)
- `deckit/theme.py` reads UDT's palette (`~/.config/rofi/udt/palette.rasi`) and
`~/.cache/udt/udt-border.lua`; the frontend uses only those CSS variables.
Text size is keystone's (`~/.config/keystone/fonts.json`, `override.deckit`
diff --git a/README.md b/README.md
index 8ef57a1..fe32f9a 100644
--- a/README.md
+++ b/README.md
@@ -62,9 +62,8 @@ launchers included, with a Restart button to apply a save.
- The Dashboard is one fixed screen. A top band of chips shows system stats,
Claude usage and the tablet's battery and Wi-Fi; music and spending sit
below. A row appears only while something is running (a print, a build, an
- OBS recording or stream), and a tap opens its tab. Action icons at the bottom
- take a screenshot or lock the PC; the tablet's screen sleeps and wakes with
- the PC's lock, however it was locked.
+ OBS recording or stream), and a tap opens its tab. The tablet's screen
+ sleeps and wakes with the PC's lock, however it was locked.
- The Windows tab has keystone's workspace icons, icon launchers, and a
preview card per window (as in the Alt+Tab switcher): tap to focus, × to
close, a long press to move it to another desktop.
diff --git a/config.toml b/config.toml
index 3083dec..f85fc4d 100644
--- a/config.toml
+++ b/config.toml
@@ -122,9 +122,6 @@ theme = "candy-icons"
apps = ["kitty", "pcmanfm-qt", "com.obsproject.Studio", "firefox", "signal-desktop"]
[dashboard]
-# Icon buttons at the bottom of the Dashboard, in order. Each id runs a fixed
-# command on the PC: screenshot opens qar-scrotmenu.sh, lock runs lock.sh.
-actions = ["screenshot", "lock"]
# keystone's updatesctl; its "to install" count shows in the system row.
# Empty hides it.
updates = "~/Programming/GIT/quickshell/desktop/modules/updates/updatesctl"
diff --git a/deckit/config.py b/deckit/config.py
index 6ce0cba..e20bc00 100644
--- a/deckit/config.py
+++ b/deckit/config.py
@@ -26,8 +26,6 @@ ROOT = Path(__file__).resolve().parent.parent
MONITOR_NAME = re.compile(r"[A-Za-z0-9_-]{1,32}")
WIFI_ADDR = re.compile(r"[A-Za-z0-9.-]{1,253}:[0-9]{1,5}")
DESKTOP_ID = re.compile(r"[A-Za-z0-9._-]{1,255}")
-# The dashboard's action buttons; deckit/modules/actions.py maps each to its command.
-ACTION_IDS = ("screenshot", "lock")
def user_config_path() -> Path:
@@ -56,9 +54,6 @@ def config_error(cfg: dict) -> str | None:
apps = cfg.get("launch", {}).get("apps", [])
if not isinstance(apps, list) or not all(isinstance(a, str) and DESKTOP_ID.fullmatch(a) for a in apps):
return "launch.apps must be a list of desktop ids, like \"kitty\""
- acts = cfg.get("dashboard", {}).get("actions", [])
- if not isinstance(acts, list) or not all(a in ACTION_IDS for a in acts):
- return f"dashboard.actions must be a list of: {', '.join(ACTION_IDS)}"
return None
diff --git a/deckit/modules/actions.py b/deckit/modules/actions.py
index 057d3b2..e29b1d5 100644
--- a/deckit/modules/actions.py
+++ b/deckit/modules/actions.py
@@ -14,31 +14,22 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""The Dashboard's action icons, and the tablet following the PC's lock.
+"""The tablet following the PC's lock.
-Each action id runs one fixed command; the client sends the id. A watcher
-checks for hyprlock every POLL seconds and sends the tablet KEYCODE_SLEEP when
-it appears and KEYCODE_WAKEUP when it goes, so every lock (the button,
-SUPER+L, hypridle) takes the tablet with it.
+A watcher checks for hyprlock every POLL seconds and sends the tablet
+KEYCODE_SLEEP when it appears and KEYCODE_WAKEUP when it goes, so every lock
+(SUPER+L, hypridle) takes the tablet with it.
"""
import subprocess
import threading
-from ..module import Module, ModuleError
+from ..module import Module
from .tablet import _adb, _find_tablet
-ACTIONS = {
- "screenshot": {"label": "Screenshot", "icon": "", "cmd": ["qar-scrotmenu.sh"]},
- "lock": {"label": "Lock", "icon": "", "cmd": ["lock.sh"]},
-}
POLL = 2
-def _popen(cmd):
- subprocess.Popen(cmd, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-
-
def _locked():
try:
return subprocess.run(["pidof", "hyprlock"], capture_output=True).returncode == 0
@@ -65,20 +56,10 @@ def follow(locked, key, was):
def make(cfg: dict) -> Module:
- ids = [i for i in cfg.get("dashboard", {}).get("actions", list(ACTIONS)) if i in ACTIONS]
- popen = cfg.get("popen", _popen)
locked = cfg.get("locked", _locked)
key = cfg.get("key", _key)
stop = threading.Event()
- def run(cmd):
- def action(body):
- try:
- popen(cmd)
- except OSError as e:
- raise ModuleError(f"{cmd[0]}: {e.strerror or e}") from e
- return action
-
def watch():
was = locked() # a server started while locked does not sleep the tablet
while not stop.wait(POLL):
@@ -86,9 +67,7 @@ def make(cfg: dict) -> Module:
return Module(
name="actions", title="Actions",
- state=lambda: {"actions": [{"id": i, "label": ACTIONS[i]["label"], "icon": ACTIONS[i]["icon"]}
- for i in ids]},
- actions={i: run(ACTIONS[i]["cmd"]) for i in ids},
+ state=dict,
start=lambda: threading.Thread(target=watch, daemon=True).start(),
stop=stop.set,
)
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
diff --git a/tests/test_actions.py b/tests/test_actions.py
index e6f31e3..3a79692 100644
--- a/tests/test_actions.py
+++ b/tests/test_actions.py
@@ -22,41 +22,9 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import subprocess
import unittest
-import deckit.config as config
-from deckit.module import ModuleError
from deckit.modules import actions
-class Actions(unittest.TestCase):
- def test_ids_match_the_config(self):
- self.assertEqual(tuple(actions.ACTIONS), config.ACTION_IDS)
-
- def test_state_lists_the_configured_actions_in_order(self):
- m = actions.make({"dashboard": {"actions": ["lock", "screenshot"]}})
- self.assertEqual([a["id"] for a in m.state()["actions"]], ["lock", "screenshot"])
- self.assertEqual(set(m.state()["actions"][0]), {"id", "label", "icon"})
-
- def test_only_configured_actions_run(self):
- calls = []
- m = actions.make({"dashboard": {"actions": ["lock"]}, "popen": calls.append})
- m.actions["lock"]({})
- self.assertEqual(calls, [["lock.sh"]])
- self.assertNotIn("screenshot", m.actions)
-
- def test_screenshot_opens_the_menu(self):
- calls = []
- m = actions.make({"dashboard": {"actions": ["screenshot"]}, "popen": calls.append})
- m.actions["screenshot"]({})
- self.assertEqual(calls, [["qar-scrotmenu.sh"]])
-
- def test_missing_command_is_a_module_error(self):
- def missing(cmd):
- raise FileNotFoundError(cmd[0])
- m = actions.make({"dashboard": {"actions": ["lock"]}, "popen": missing})
- with self.assertRaises(ModuleError):
- m.actions["lock"]({})
-
-
class Follow(unittest.TestCase):
def test_sleeps_on_lock_and_wakes_on_unlock(self):
keys = []
diff --git a/tests/test_config.py b/tests/test_config.py
index 906d8d3..928a8e8 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -39,17 +39,10 @@ class Config(unittest.TestCase):
{"ports": {"command_center": 80}},
{"ports": {"command_center": 5900, "display": 5900}},
{"wifi": {"address": "x; rm -rf ~"}},
- {"launch": {"apps": ["ok", "../evil"]}},
- {"dashboard": {"actions": ["screenshot", "rm -rf"]}},
- {"dashboard": {"actions": "lock"}}]
+ {"launch": {"apps": ["ok", "../evil"]}}]
for cfg in bad:
self.assertIsNotNone(config.config_error(cfg), cfg)
- def test_dashboard_actions(self):
- self.assertIsNone(config.config_error({"dashboard": {"actions": []}}))
- self.assertIsNone(config.config_error({"dashboard": {"actions": ["lock", "screenshot"]}}))
- self.assertEqual(config.ACTION_IDS, ("screenshot", "lock"))
-
def test_user_file_overrides_key_by_key(self):
cfg = config.merge({"display": {"enabled": True, "scale": 1}, "launch": {"apps": ["a", "b"]}},
{"display": {"enabled": False}, "launch": {"apps": ["c"]}})