triggerhappy: the machine's hotkeys as a module holding node-hotkeys (hq ADR 0212)

The laptop's model module owned triggerhappy's trigger file and service, although the daemon is a
general piece others have keys for. triggerhappy now owns the daemon, reads only the mesh's file,
runs every trigger as the account, and the model module contributes its vendor keys.
This commit is contained in:
jochen
2026-10-04 16:50:57 +02:00
parent 2d613ae274
commit afce6b03f4
11 changed files with 607 additions and 45 deletions
+73
View File
@@ -0,0 +1,73 @@
{
"module": "triggerhappy",
"version": "1",
"capabilities": [
"service-manager"
],
"claims": [
{
"name": "node-hotkeys",
"scope": "node"
}
],
"tools": [
"triggerhappy_keys",
"triggerhappy_devices",
"triggerhappy_dump",
"triggerhappy_check"
],
"resources": [
{
"id": "drop-ins",
"type": "directory",
"path": "/etc/systemd/system/triggerhappy.service.d",
"mode": "0755"
},
{
"id": "as-account",
"type": "file",
"path": "/etc/systemd/system/triggerhappy.service.d/mesh.conf",
"mode": "0644",
"content": "# Written by the mesh (module triggerhappy, novox/hq ADR 0212). Replaced on every push.\n#\n# The daemon opens the input devices as root, then drops to the operator's account with its groups,\n# so every trigger runs as the account: it reaches the account's session bus and display, with no su\n# and no hard-coded user. Only the mesh's trigger file is read.\n[Service]\nExecStart=\nExecStart=/usr/bin/thd --triggers /etc/triggerhappy/triggers.d/mesh.conf --socket /run/thd.socket --user ${machine:account} --deviceglob /dev/input/event*\n"
},
{
"id": "triggers-dir",
"type": "directory",
"path": "/etc/triggerhappy/triggers.d",
"mode": "0755"
},
{
"id": "triggers",
"type": "file",
"path": "/etc/triggerhappy/triggers.d/mesh.conf",
"mode": "0644",
"content": "# The machine's hotkeys, written by the mesh (module triggerhappy, novox/hq ADR 0212). Replaced on\n# every push: a key is added by the module it belongs to, as a contribution to node-hotkeys.\n# A line is: the key, its state (1 pressed, 2 held, 0 released), the command.\n${contribution:node-hotkeys:trigger}"
},
{
"id": "service",
"type": "service",
"unit": "triggerhappy.service",
"state": "running",
"boot": "enabled",
"restart-on": [
"as-account",
"triggers"
]
}
],
"build": {
"artifacts": [
{
"name": "tools",
"kind": "bundle",
"language": "go",
"system": "arch",
"from": "cmd/triggerhappy-tools",
"binary": "triggerhappy-tools",
"loads": [
"triggerhappy-tools"
]
}
]
}
}