Skip to content

Add Asus Zenbook UX3404 hotkey support #5535

Closed
niraletter wants to merge 6 commits intobasecamp:devfrom
niraletter:fix-asus-zenbook-ux3404-wmi-hotkeys
Closed

Add Asus Zenbook UX3404 hotkey support #5535
niraletter wants to merge 6 commits intobasecamp:devfrom
niraletter:fix-asus-zenbook-ux3404-wmi-hotkeys

Conversation

@niraletter
Copy link
Copy Markdown
Contributor

@niraletter niraletter commented May 1, 2026

Summary

Adds fix/support for hardware hotkeys on Asus Zenbook machines (especially UX3404 model also should work on all zenbook lineups having the hotkeys).

PR includes:

  1. Camera toggle via XF86WebCam - USB unbind/bind with hardware LED sync
  2. Fan profile cycling via XF86Fn_F - ACPI platform_profile rotation
  3. Mic toggle fix - using wpctl for reliable audio source toggling. Hardware LED syncs by default
  4. Creates a passwordless sudoers rule scoped to Zenbook hardware, for camera and fan profile toggles

All three feature swayosd notifications showing current state with appropriate system icons.


Detailed Changes

Camera Toggle (XF86WebCam)

cam

Problem: A lot of Asus Zenbook devices ship with a dedicated camera toggle hotkey (XF86WebCam) that had no binding and did nothing.

Solution: Physical USB device unbind/bind to fully disconnect the internal webcam, with hardware LED sync and OSD feedback.

  • bin/omarchy-toggle-camera-zenbook (new)

    • Targets USB device 3-8 at /sys/bus/usb/drivers/usb/3-8
    • Checks if device path exists to determine current state
    • Unbinds device to turn camera off, binds to turn on
    • Syncs hardware LED (asus::camera) via brightnessctl - sets to 0 when camera is active, 1 when disabled
    • Shows swayosd icons and labels for on/off state
  • install/config/hardware/asus/fix-zenbook-camera.sh (new)

    • Guarded by omarchy-hw-match "Zenbook" - only runs on Zenbook hardware
    • Installs a root-owned wrapper script at /usr/local/sbin/omarchy-camera-zenbook-usb that validates the action (bind/unbind) and device ID (only allows 1-8) before writing to sysfs. Creates /etc/sudoers.d/omarchy-camera-zenbook with NOPASSWD rule scoped to this wrapper script only - not raw sysfs paths. Wrapper has 755 permissions, sudoers file has 440.
  • default/hypr/bindings/media.conf (modified)

    • Added bindld = ,XF86WebCam, Toggle camera, exec, omarchy-toggle-camera-zenbook
  • install/config/all.sh (modified)

    • Registered fix-zenbook-camera.sh in the ASUS hardware install chain

Fan Profile Cycling (XF86Fn_F)

fan

Problem: Zenbook laptops have a dedicated fan profile hotkey (XF86Fn_F) that was unbound.

Solution: Cycle through ACPI platform profiles directly via sysfs with OSD showing current mode.

  • bin/omarchy-toggle-fan-profile-zenbook (new)

    • Reads current profile from /sys/firmware/acpi/platform_profile
    • Cycles: quiet - balanced - performance - quiet
    • Falls back to balanced for unknown states
    • Shows swayosd icons and labels for all three profile states
  • install/config/hardware/asus/fix-zenbook-fan-profile.sh (new)

    • Guarded by omarchy-hw-match "Zenbook"
    • Creates /etc/sudoers.d/omarchy-zenbook-fan-profile with NOPASSWD rule for /usr/bin/tee /sys/firmware/acpi/platform_profile
    • File permissions set to 440
  • default/hypr/bindings/utilities.conf (modified)

    • Added bindld = , XF86Fn_F, Cycle fan profile, exec, omarchy-toggle-fan-profile-zenbook
  • install/config/all.sh (modified)

    • Registered fix-zenbook-fan-profile.sh in the ASUS hardware install chain

Mic Toggle Fix

image image

Problem: The default mic toggle handler (omarchy-swayosd-client --input-volume mute-toggle) did not work correctly on Zenbook hardware (esp. UX3404)

Solution: Usess wpctl handler for reliable microphone mute toggling. Hardware LED syncs by default

  • bin/omarchy-audio-input-mute-zenbook (new)

    • Uses wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle for reliable toggling
    • Shows swayosd with "Microphone muted" / "Microphone on" and corresponding icons
  • bin/omarchy-audio-input-mute (modified)

    • Updated dispatch chain: XPS - ThinkPad - Zenbook - default fallback
    • Physical mic button now routes to omarchy-audio-input-mute-zenbook on Zenbook systems

Copilot AI review requested due to automatic review settings May 1, 2026 18:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Zenbook-specific hotkey handlers (camera toggle, fan profile cycling, mic mute) to Omarchy’s Hyprland bindings, plus installer-time sudoers setup to allow safe-ish sysfs writes needed for those toggles on supported Asus Zenbook hardware.

Changes:

  • Add Zenbook camera toggle (USB unbind/bind + LED + OSD) and bind it to XF86WebCam.
  • Add Zenbook fan platform profile cycler (sysfs + OSD) and bind it to XF86Fn_F, with sudoers setup.
  • Add Zenbook-specific mic mute handler using wpctl, routed via the existing omarchy-audio-input-mute dispatcher.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
install/config/hardware/asus/fix-zenbook-fan-profile.sh Adds sudoers rule to allow writing ACPI platform_profile without prompting.
install/config/hardware/asus/fix-zenbook-camera.sh Adds sudoers rule to allow USB bind/unbind writes for camera toggling.
install/config/all.sh Registers the new Zenbook fix scripts in the installer hardware chain.
default/hypr/bindings/utilities.conf Binds XF86Fn_F to the Zenbook fan profile script.
default/hypr/bindings/media.conf Binds XF86WebCam to the Zenbook camera toggle script.
bin/omarchy-toggle-fan-profile-zenbook New fan profile cycling implementation using /sys/firmware/acpi/platform_profile.
bin/omarchy-toggle-camera-zenbook New camera toggle implementation using USB unbind/bind + asus::camera LED + OSD.
bin/omarchy-audio-input-mute-zenbook New Zenbook mic mute implementation using wpctl + OSD.
bin/omarchy-audio-input-mute Extends dispatch chain to route Zenbook mic mute to the new handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install/config/hardware/asus/fix-zenbook-camera.sh
Copilot AI review requested due to automatic review settings May 1, 2026 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Asus Zenbook-specific hotkey handling to Omarchy (camera toggle, fan profile cycling, and a Zenbook mic-mute handler) and wires these into the default Hyprland keybindings, with install-time sudoers setup for passwordless sysfs operations on matching hardware.

Changes:

  • Add Zenbook camera toggle (USB bind/unbind) with install-time sudo helper + sudoers rule.
  • Add Zenbook fan profile cycler (ACPI platform_profile) with sudoers rule and keybinding.
  • Add Zenbook mic mute implementation using wpctl, routed via the existing omarchy-audio-input-mute dispatcher.

Reviewed changes

Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
install/config/hardware/asus/fix-zenbook-fan-profile.sh Installs a sudoers rule enabling passwordless writes to platform_profile on Zenbook systems.
install/config/hardware/asus/fix-zenbook-camera.sh Installs a root-owned helper and sudoers rule intended to enable passwordless camera USB bind/unbind on Zenbooks.
install/config/all.sh Registers the two new Zenbook install-time fix scripts in the Asus hardware chain.
default/hypr/bindings/utilities.conf Adds a default keybinding for fan profile cycling (XF86Fn_F).
default/hypr/bindings/media.conf Adds a default keybinding for camera toggle (XF86WebCam).
bin/omarchy-toggle-fan-profile-zenbook Implements profile cycling with OSD feedback by writing to platform_profile.
bin/omarchy-toggle-camera-zenbook Implements USB unbind/bind camera toggle with LED + OSD feedback.
bin/omarchy-audio-input-mute-zenbook Implements Zenbook mic mute toggle using wpctl + OSD feedback.
bin/omarchy-audio-input-mute Adds Zenbook routing to the mic-mute dispatcher chain.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +26
case "$device_id" in
1-8)
;;
*)
echo "Refusing to ${action} unexpected USB device id: ${device_id}" >&2
exit 1
;;
esac
Comment thread default/hypr/bindings/media.conf
bindld = , XF86PowerOff, Power menu, exec, omarchy-menu system
bindd = SUPER, K, Show key bindings, exec, omarchy-menu-keybindings
bindd = , XF86Calculator, Calculator, exec, gnome-calculator
bindld = , XF86Fn_F, Cycle fan profile, exec, omarchy-toggle-fan-profile-zenbook
Copilot AI review requested due to automatic review settings May 1, 2026 18:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Adds Zenbook-specific hotkey handling to the Omarchy Hyprland defaults and installer hardware-fix chain, including sudoers rules/wrappers to safely perform privileged sysfs operations for camera and fan profile toggles.

Changes:

  • Add Zenbook camera hotkey toggle (USB bind/unbind + LED sync + OSD) and an installer-provisioned root wrapper + sudoers entry.
  • Add Zenbook fan profile hotkey toggle (ACPI platform_profile cycling + OSD) and an installer-provisioned sudoers entry.
  • Add Zenbook-specific mic mute handling using wpctl, routed via the existing omarchy-audio-input-mute dispatcher.

Reviewed changes

Copilot reviewed 5 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
install/config/hardware/asus/fix-zenbook-fan-profile.sh Adds Zenbook-only sudoers entry to allow writing platform_profile via tee.
install/config/hardware/asus/fix-zenbook-camera.sh Installs a root-owned USB bind/unbind wrapper and corresponding sudoers entry (Zenbook-only).
install/config/all.sh Registers the new Zenbook hardware fix scripts in the ASUS install chain.
default/hypr/bindings/utilities.conf Binds XF86Fn_F to fan profile cycling script.
default/hypr/bindings/media.conf Binds XF86WebCam to the Zenbook camera toggle (guarded by hardware match).
bin/omarchy-toggle-fan-profile-zenbook Implements platform profile cycling with OSD feedback.
bin/omarchy-toggle-camera-zenbook Implements camera USB unbind/bind toggle with LED + OSD.
bin/omarchy-audio-input-mute-zenbook Implements Zenbook mic mute toggle via wpctl with OSD feedback.
bin/omarchy-audio-input-mute Routes Zenbook mic mute hotkey to the new Zenbook handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

bindld = , XF86PowerOff, Power menu, exec, omarchy-menu system
bindd = SUPER, K, Show key bindings, exec, omarchy-menu-keybindings
bindd = , XF86Calculator, Calculator, exec, gnome-calculator
bindld = , XF86Fn_F, Cycle fan profile, exec, omarchy-toggle-fan-profile-zenbook
Comment on lines +19 to +26
case "$device_id" in
1-8)
;;
*)
echo "Refusing to ${action} unexpected USB device id: ${device_id}" >&2
exit 1
;;
esac
@niraletter niraletter force-pushed the fix-asus-zenbook-ux3404-wmi-hotkeys branch from 88bd60f to 44b3265 Compare May 1, 2026 18:42
Copilot AI review requested due to automatic review settings May 1, 2026 18:45
@niraletter niraletter force-pushed the fix-asus-zenbook-ux3404-wmi-hotkeys branch from 44b3265 to a981720 Compare May 1, 2026 18:45
@niraletter niraletter marked this pull request as draft May 1, 2026 19:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@niraletter niraletter requested a review from Copilot May 1, 2026 19:09
@niraletter niraletter marked this pull request as ready for review May 1, 2026 19:11
@niraletter
Copy link
Copy Markdown
Contributor Author

niraletter commented May 1, 2026

closing this, bind/unbind is not needed, there is much simpler approach

@niraletter niraletter closed this May 1, 2026
@niraletter niraletter changed the title Add Asus Zenbook hotkey support (camera, fan profile, mic mute fix) for UX3404 and similar models Add Asus Zenbook UX3404 hotkey support May 1, 2026
@niraletter niraletter review requested due to automatic review settings May 1, 2026 19:33
@niraletter
Copy link
Copy Markdown
Contributor Author

niraletter commented May 2, 2026

mic-mute sorted 241145f

@niraletter niraletter deleted the fix-asus-zenbook-ux3404-wmi-hotkeys branch May 4, 2026 09:57
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