Skip to content

feat(hotkey): open the dashboard from the OMEN key - #27

Merged
Batuhan4 merged 2 commits into
Batuhan4:mainfrom
hemangjoshi37a:upstream/omen-key
Sep 24, 2026
Merged

Batuhan4 merged 2 commits into
Batuhan4:mainfrom
hemangjoshi37a:upstream/omen-key

Conversation

@hemangjoshi37a

Copy link
Copy Markdown
Contributor

What this adds

The dedicated OMEN key above the keyboard did nothing on Linux. This makes it open the Victus Control dashboard.

The hp-wmi driver already reports it — nothing was listening. Confirmed by reading the driver's own keymap over EVIOCGKEYCODE_V2 rather than guessing:

scancode     keycode  name
0x000021a5   149      KEY_PROG2
0x000021a8   149      KEY_PROG2   <- the OMEN key

victus-hotkeyd

A small daemon that watches for KEY_PROG2 and runs victus-control.

  • Finds the device by name, not by event number — /dev/input/eventN is not stable across reboots or DKMS rebuilds.
  • Re-scans every 5 s if the device disappears, so modprobe -r hp_wmi during an install or a DKMS rebuild does not require restarting the service.
  • Debounces at 400 ms; the firmware sometimes reports one physical press twice.
  • Double-forks the GUI, so it never accumulates zombies however often the key is pressed.

It ships as a user unit rather than a system one, because it launches a GUI and has to live in the session that owns the display.

Permissions

99-victus-hotkey.rules grants the hotkey device to the victus group, matching how the fan and backlight nodes are already handled.

That device carries only the firmware hotkeys — brightness, mic mute, OMEN — and never the typing keyboard, so this exposes no keystrokes. It is deliberately narrower than adding the user to the input group, which would hand over every input device including the real keyboard.

Single instance

The frontend becomes a GtkApplication. Without it every press would stack up another dashboard; now a second press raises the window that is already open. The .desktop file gains a matching StartupWMClass so the shell still pairs the window with the launcher.


Second commit: fan-mode guard

fix(fan): keep the firmware curve when the board exposes no fan target is independent of the OMEN key and happy to be split into its own PR if you'd prefer.

MANUAL (and BETTER_AUTO, which drives the fans through MANUAL) turns the firmware curve off and then writes fanN_target. On a board with no target only the first half happens: pwm1_enable goes to 1, every target write fails, and the fans are left wherever they were with nothing managing cooling.

Observed on 8E5F / Victus 15-fb3xxx, where hp-wmi/hwmon/hwmonN/ exposes only fan1_input, fan2_input, pwm1_enable — no targets, with the patched module loaded. The backend logged this every few seconds:

COMMAND=/usr/bin/set-fan-mode.sh MANUAL          <- succeeded
COMMAND=/usr/bin/set-fan-speed.sh 1 4171
victus-backend: Failed to execute set-fan-speed.sh for fan 1. Exit code: 1

The guard refuses only that combination. AUTO and MAX are driven by pwm1_enable alone and keep working; boards that do expose fanN_target are unaffected.


Hardware validation

Tested on HP Victus 15-fb3xxx (board 8E5F), Ubuntu 26.10, kernel 7.0.0-30, GTK4, single-zone keyboard.

Check Result
OMEN key opens the dashboard works
Second press raises, does not duplicate works
Synthetic KEY_PROG2 via uinput app launched
Device removal / re-scan recovery recovered, logged "HP WMI hotkeys" went away, waiting for it to come back
AUTO / MAX fan modes pwm1_enable 2 / 0
MANUAL on a board with no target refused, stays on AUTO
Keyboard colour + brightness writes SET/GET round-trip OK
CPU / GPU temp, fan RPM reads OK
meson test 2/2 pass

Because this board has no fan targets, GET_FAN_TARGET_SUPPORT reports UNSUPPORTED and the UI already hides manual speed — so the guard is belt-and-braces for anything that calls the script directly.

I don't have a four-zone Omen board to test against; the hotkey path is independent of zone count, but a second pair of eyes there would be welcome.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ELZkKrF8iHGDQG3qK19xcG

hemangjoshi37a and others added 2 commits September 5, 2026 21:09
MANUAL (and BETTER_AUTO, which drives the fans through MANUAL) turns the
firmware fan curve off and then writes fanN_target to set a speed. On boards
that expose no target -- 8E5F / Victus 15-fb3xxx among them -- only the first
half of that happens: pwm1_enable is set to 1, every fanN_target write fails,
and the fans are left at whatever RPM they happened to be at with nothing
managing cooling.

Refuse that combination and stay on the firmware curve instead. AUTO and MAX
are both driven by pwm1_enable alone, so they keep working; boards that do
expose fanN_target are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ELZkKrF8iHGDQG3qK19xcG
HP Victus and Omen laptops have a dedicated OMEN key above the keyboard that
did nothing on Linux. The hp-wmi driver already reports it on its "HP WMI
hotkeys" input device as KEY_PROG2 (scancodes 0x21a5 and 0x21a8 both map to
it), so all that was missing was something listening.

victus-hotkeyd watches for that key and runs victus-control. It finds the
device by name rather than by event number, which is not stable across reboots
or DKMS rebuilds, and re-scans every 5s if the device disappears so a module
reload does not require restarting the service. Presses are debounced, since
the firmware sometimes reports one press twice.

It ships as a *user* unit, not a system one: it launches a GUI, so it has to
live in the session that owns the display. Reading the hotkey device is granted
to the victus group by a udev rule, matching how the fan and backlight nodes
are already handled. That device only carries the firmware hotkeys --
brightness, mic mute, OMEN -- never the typing keyboard, so this exposes no
keystrokes; it is deliberately narrower than adding the user to the input
group.

The frontend becomes a GtkApplication so the process is a single instance.
Without that, every press would stack up another dashboard; now a second press
raises the window that is already open. The .desktop file gains a matching
StartupWMClass so the shell still pairs the window with the launcher.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ELZkKrF8iHGDQG3qK19xcG
Batuhan4 added a commit that referenced this pull request Sep 24, 2026
#27 only wired victus-hotkeyd into the Ubuntu installer; meson already
installs the binary, user unit and udev rule on every distro, so mirror the
same enable step and input-subsystem trigger.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Batuhan4
Batuhan4 merged commit 7581bc2 into Batuhan4:main Sep 24, 2026
6 checks passed
@Batuhan4

Copy link
Copy Markdown
Owner

Merged — thank you! The OMEN key listener and the fan-mode guard are both great additions, and the hardware test notes made review easy. I added a small follow-up that wires victus-hotkeyd into the Arch and Fedora installers too (0e599bb).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants