From 88f120cb544296f4c760546a204f1e2268a2e5dd Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 30 Nov 2026 11:01:09 +0100 Subject: feat(dashboard): drop the action icons row The screenshot and lock buttons went unused; the keyboard is faster. The actions module keeps only the hyprlock watcher that sleeps and wakes the tablet, under the same name since keystone's module toggle uses it. [dashboard] actions is gone from the config and its validation. Co-Authored-By: Claude Opus 5.5 --- deckit/modules/actions.py | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'deckit/modules/actions.py') 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, ) -- cgit v1.2.3