diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-30 11:01:09 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-30 11:01:09 +0100 |
| commit | 88f120cb544296f4c760546a204f1e2268a2e5dd (patch) | |
| tree | be14896616b3733556f3bc10a1406fc3c84d6044 /deckit/modules/actions.py | |
| parent | 96355cff09db091f5251ae851c46b8d1dd67f7a0 (diff) | |
| download | deck-it-88f120cb544296f4c760546a204f1e2268a2e5dd.tar.gz deck-it-88f120cb544296f4c760546a204f1e2268a2e5dd.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'deckit/modules/actions.py')
| -rw-r--r-- | deckit/modules/actions.py | 33 |
1 files changed, 6 insertions, 27 deletions
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, ) |
