fix(snap): add hardware-observe so hotkeys can read input devices (#858)

Snap confinement denies /proc/bus/input/devices unless hardware-observe
is connected. Declare the plug, tell users to connect it next to
raw-input, and update the in-app hints.

Fixes #857
This commit is contained in:
Jatin K Malik
2026-09-23 00:09:54 -07:00
committed by GitHub
parent acd90fdd05
commit 5b4e2c3572
8 changed files with 69 additions and 6 deletions
@@ -127,8 +127,8 @@ def find_keyboard_devices() -> list[str]:
Prefers /proc/bus/input/devices (host installs). Falls back to
``evdev.list_devices()`` when that path cannot be read (common under snap
confinement even with raw-input, which grants /dev/input/event* but may
still deny /proc/bus/input/devices).
confinement: raw-input grants /dev/input/event*, while hardware-observe
is the plug that grants /proc/bus/input/devices).
Returns:
List of device paths for keyboard devices
@@ -424,7 +424,8 @@ class EvdevKeyboardBackend(KeyboardBackend):
return (
"Snap is missing input-device access. "
"Connect once, then restart:\n"
"sudo snap connect vocalinux:raw-input"
"sudo snap connect vocalinux:raw-input\n"
"sudo snap connect vocalinux:hardware-observe"
)
return (
"Add your user to the 'input' group and log out/in:\n"
@@ -432,11 +433,13 @@ class EvdevKeyboardBackend(KeyboardBackend):
)
return None
# No devices found — snap without raw-input often cannot list anything.
# No devices found: snap without raw-input and hardware-observe
# often cannot list anything.
if in_snap:
return (
"Snap is missing input-device access. Connect once, then restart:\n"
"sudo snap connect vocalinux:raw-input"
"sudo snap connect vocalinux:raw-input\n"
"sudo snap connect vocalinux:hardware-observe"
)
try:
+1
View File
@@ -102,6 +102,7 @@ class KeyboardShortcutManager:
logger.warning("=" * 60)
logger.warning("Global hotkeys read /dev/input (evdev). Connect once:")
logger.warning(" sudo snap connect vocalinux:raw-input")
logger.warning(" sudo snap connect vocalinux:hardware-observe")
logger.warning("Then restart Vocalinux. Until then, use the system tray.")
logger.warning("=" * 60)
return