Description
Binding VolumeUp / VolumeDown (or MuteVolume) to a mouse button does not change the system volume, even though the hook correctly detects the button press and reports:
button → executing bound action button=Back action=Volume Up
button → executing bound action button=Forward action=Volume Down
Root cause
The Action::VolumeUp / VolumeDown variants call macos::post_key(0x48/0x49, none) which posts CGEventCreateKeyboardEvent events to kCGHIDEventTap. On macOS, the volume keys (kVK_VolumeUp=0x48, kVK_VolumeDown=0x49, kVK_Mute=0x4A) are system-defined keys — they are not standard HID keyboard usages and CGEventPost to kCGHIDEventTap does not trigger the system volume handler.
Verified workaround
Using osascript to change volume works reliably:
osascript -e "set volume output volume ((output volume of (get volume settings)) + 7)"
Suggested fix
Volume (and potentially media) keys need to be posted as NSSystemDefined events (event type 14 / NSSystemDefined, subtype 8) rather than via CGEventCreateKeyboardEvent. The NX key types are:
NX_KEYTYPE_SOUND_UP = 0
NX_KEYTYPE_SOUND_DOWN = 1
NX_KEYTYPE_MUTE = 7
This is the same mechanism that post_media_key (line 828 of crates/openlogi-core/src/binding.rs) currently has as a stub — it also needs the NSSystemDefined approach.
Environment
- macOS 26.5.1 (Sequoia)
- OpenLogi v0.5.1
- Logitech MX Master 3S (Bluetooth LE)
Description
Binding
VolumeUp/VolumeDown(orMuteVolume) to a mouse button does not change the system volume, even though the hook correctly detects the button press and reports:Root cause
The
Action::VolumeUp/VolumeDownvariants callmacos::post_key(0x48/0x49, none)which postsCGEventCreateKeyboardEventevents tokCGHIDEventTap. On macOS, the volume keys (kVK_VolumeUp=0x48,kVK_VolumeDown=0x49,kVK_Mute=0x4A) are system-defined keys — they are not standard HID keyboard usages and CGEventPost tokCGHIDEventTapdoes not trigger the system volume handler.Verified workaround
Using
osascriptto change volume works reliably:osascript -e "set volume output volume ((output volume of (get volume settings)) + 7)"Suggested fix
Volume (and potentially media) keys need to be posted as NSSystemDefined events (event type 14 / NSSystemDefined, subtype 8) rather than via
CGEventCreateKeyboardEvent. The NX key types are:NX_KEYTYPE_SOUND_UP = 0NX_KEYTYPE_SOUND_DOWN = 1NX_KEYTYPE_MUTE = 7This is the same mechanism that
post_media_key(line 828 ofcrates/openlogi-core/src/binding.rs) currently has as a stub — it also needs the NSSystemDefined approach.Environment