Getting the Zenbook Duo Working on Linux
The Problem
On the ASUS Zenbook Duo (UX8406MA), detaching the keyboard triggers a spurious wireless disable event that turns off WiFi. This is a known Linux kernel bug. While a fix was merged into kernel 6.11+, it doesn't work reliably on all systems.
Symptoms:
- WiFi turns off when you detach the keyboard
- WiFi may also turn off when you reattach the keyboard
- You have to manually re-enable WiFi each time
The Solution
This is a complete setup for the Zenbook Duo that handles keyboard attach/detach events intelligently.
What it does:
- Automatically unblocks WiFi (rfkill) when keyboard events happen
- Automatically enables/disables the second screen based on keyboard state
- Properly maps touchscreen inputs to the correct displays
- Provides desktop notifications for all events
- Configures stacked monitor layout (top/bottom) for dual-screen mode
- Sets up media key bindings (volume, brightness, etc.)
- Runs efficiently with zero overhead when idle (event-driven, no background processes)
Installation
1. Create the system handler script
This script runs as root and handles WiFi re-enabling:
sudo tee /usr/local/bin/zenbook-kbd-system.sh > /dev/null << 'EOF'
#!/bin/bash
# System-level handler for Zenbook Duo keyboard events
# Handles root-level operations (rfkill, etc.)
ACTION=$1
LOGPREFIX="Zenbook-System"
LOCK_FILE="/tmp/zenbook-kbd-system-${ACTION}.lock"
# Atomic lock - prevents duplicate runs
exec 200>"$LOCK_FILE"
if ! flock -n -x 200; then
exit 0 # Another instance is already running, skip
fi
case "$ACTION" in
remove)
# Keyboard detached - keep WiFi alive
logger "$LOGPREFIX: Keyboard detached, maintaining WiFi"
sleep 0.5
rfkill unblock wifi
;;
add)
# Keyboard attached - also unblock WiFi (spurious toggle happens on reattach too)
logger "$LOGPREFIX: Keyboard attached, maintaining WiFi"
sleep 0.5
rfkill unblock wifi
;;
esac
# Hold the lock briefly so other instances will skip
sleep 0.5
EOF
sudo chmod +x /usr/local/bin/zenbook-kbd-system.sh
2. Create the user handler script
This script runs as your user and handles notifications and other Hyprland-specific actions:
mkdir -p ~/.local/bin
cat > ~/.local/bin/zenbook-kbd-user.sh << 'EOF'
#!/bin/bash
# User-level handler for Zenbook Duo keyboard events
# Handles Hyprland-specific operations (notifications, display changes, etc.)
ACTION=$1
USER_NAME="sam"
USER_ID=$(id -u $USER_NAME)
LOCK_FILE="/tmp/zenbook-kbd-${ACTION}.lock"
# Atomic lock with timeout - prevents duplicate runs
exec 200>"$LOCK_FILE"
if ! flock -n -x 200; then
exit 0 # Another instance is already running, skip
fi
# Get Hyprland environment
export XDG_RUNTIME_DIR="/run/user/$USER_ID"
export HYPRLAND_INSTANCE_SIGNATURE=$(ls $XDG_RUNTIME_DIR/hypr/ 2>/dev/null | head -n1)
case "$ACTION" in
remove)
# Keyboard detached - enable second screen (dual screen mode, stacked below)
hyprctl keyword monitor eDP-2,2880x1800@120,0x1000,1.8
notify-send "Zenbook KB Detached" "Second screen enabled" -u low
logger "Zenbook-User: Keyboard detached (user handler)"
;;
add)
# Keyboard attached - disable second screen (keyboard covers it)
hyprctl keyword monitor eDP-2,disable
notify-send "Zenbook KB Attached" "Second screen disabled" -u low
logger "Zenbook-User: Keyboard attached (user handler)"
;;
esac
# Hold the lock briefly so other instances will skip
sleep 0.5
EOF
chmod +x ~/.local/bin/zenbook-kbd-user.sh
Important: Edit the USER_NAME="sam" line to match your actual username!
Note: The monitor configuration above assumes 2880x1800@120Hz displays. Adjust the resolution/refresh rate if yours differs.
3. Configure Hyprland monitors
Edit ~/.config/hypr/monitors.conf to set up the dual-screen stacked layout:
# Stacked layout - second screen below first (in logical pixels accounting for 1.8 scale)
monitor=eDP-1,2880x1800@120,0x0,1.8
monitor=eDP-2,2880x1800@120,0x1000,1.8
The position 0x1000 places the second screen directly below the first. With 1.8x scaling, the logical height is 1000px (1800/1.8=1000).
4. Map touchscreens to correct displays
Edit ~/.config/hypr/input.conf and add these device mappings at the end:
# Map touchscreens to correct displays
device {
name = elan9008:00-04f3:425b
output = eDP-1
}
device {
name = elan9009:00-04f3:425a
output = eDP-2
}
This ensures touch input on each screen registers on the correct display.
5. Set up media key bindings (optional)
Since the Fn key doesn't work with F-keys on the detached keyboard, add these bindings to ~/.config/hypr/bindings.conf:
# Media keys (Fn key doesn't work with F-keys on Zenbook Duo, using Super instead)
bindd = SUPER, F2, Volume down, exec, swayosd-client --output-volume lower
bindd = SUPER, F3, Volume up, exec, swayosd-client --output-volume raise
bindd = SUPER, F4, Mic mute, exec, swayosd-client --input-volume mute-toggle
bindd = SUPER, F5, Brightness down, exec, brightnessctl -d intel_backlight set 5%- && swayosd-client --brightness lower
bindd = SUPER, F6, Brightness up, exec, brightnessctl -d intel_backlight set 5%+ && swayosd-client --brightness raise
bindd = SUPER, F9, Mute, exec, swayosd-client --output-volume mute-toggle
This uses swayosd-client for visual OSD popups (Omarchy default). If you don't use swayosd, replace with wpctl commands.
6. Create the udev rule
This rule triggers both scripts when the keyboard is attached or detached:
sudo tee /etc/udev/rules.d/99-zenbook-keyboard.rules > /dev/null << 'EOF'
# ASUS Zenbook Duo Keyboard Event Handler
# Vendor: 0b05 (ASUS), Product: 1b2c (Zenbook Duo Keyboard)
# Keyboard removed - match interface 1.0 specifically (first interface)
ACTION=="remove", SUBSYSTEM=="usb", KERNEL=="*:1.0", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1b2c", \
RUN+="/usr/local/bin/zenbook-kbd-system.sh remove", \
RUN+="/usr/bin/sudo -u sam /home/sam/.local/bin/zenbook-kbd-user.sh remove"
# Keyboard added - only trigger once on interface 0
ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceNumber}=="00", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1b2c", \
RUN+="/usr/local/bin/zenbook-kbd-system.sh add", \
RUN+="/usr/bin/sudo -u sam /home/sam/.local/bin/zenbook-kbd-user.sh add"
EOF
Important: Replace sam in the udev rule with your actual username (appears twice in the file)!
7. Reload udev rules and Hyprland config
sudo udevadm control --reload-rules
sudo udevadm trigger
hyprctl reload
Testing
-
Detach your keyboard - you should see:
- Notification: "Zenbook KB Detached - Second screen enabled"
- WiFi stays connected
- Second screen appears below the first screen
- Touch input works correctly on both screens
-
Reattach your keyboard - you should see:
- Notification: "Zenbook KB Attached - Second screen disabled"
- WiFi stays connected
- Second screen turns off (keyboard covers it)
-
Test media keys (with keyboard attached):
- Super+F2/F3: Volume down/up with OSD popup
- Super+F5/F6: Brightness down/up with OSD popup
- Super+F9: Mute toggle with OSD popup
Check the logs to verify it's working:
journalctl -n 50 --no-pager | grep -E "Zenbook-"
You should see entries like:
Zenbook-System: Keyboard detached, maintaining WiFiZenbook-User: Keyboard detached (user handler)
Customization
Disable notifications
Edit ~/.local/bin/zenbook-kbd-user.sh and comment out or remove the notify-send lines:
# notify-send "Zenbook KB Detached" "Second screen enabled" -u low
Disable second screen automation
If you want to keep the second screen always enabled (not auto-toggle), edit ~/.local/bin/zenbook-kbd-user.sh and comment out the hyprctl keyword monitor lines.
Change monitor layout
To change from stacked (top/bottom) to side-by-side, edit ~/.config/hypr/monitors.conf:
# Side-by-side layout
monitor=eDP-1,2880x1800@120,0x0,1.8
monitor=eDP-2,2880x1800@120,1600x0,1.8 # Position to the right (1600 = 2880/1.8)
Add custom actions
You can add any commands in the user script. Examples:
Rotate display when detaching:
remove)
hyprctl keyword monitor eDP-2,2880x1800@120,0x1000,1.8
hyprctl keyword monitor eDP-1,transform,1 # Rotate to portrait
notify-send "Zenbook KB Detached" "Second screen enabled" -u low
;;
Switch workspace layout:
remove)
hyprctl keyword monitor eDP-2,2880x1800@120,0x1000,1.8
hyprctl keyword general:layout dwindle # Switch to tablet-friendly layout
notify-send "Zenbook KB Detached" "Tablet mode" -u low
;;
Launch/close apps:
remove)
hyprctl keyword monitor eDP-2,2880x1800@120,0x1000,1.8
killall waybar # Hide status bar in tablet mode
notify-send "Zenbook KB Detached" "Second screen enabled" -u low
;;
add)
hyprctl keyword monitor eDP-2,disable
waybar & # Show status bar with keyboard
notify-send "Zenbook KB Attached" "Second screen disabled" -u low
;;
Multi-monitor workspaces
In Hyprland, each monitor has independent workspaces. With dual screens enabled:
- Use
Super + 1-9to switch workspaces on the current monitor (where your cursor is) - Use
Super + Shift + 1-9to move windows between workspaces - Use
Super + Tab/Super + Shift + Tabto cycle through workspaces - You can have workspace 1 on the top screen AND workspace 1 on the bottom screen simultaneously
Troubleshooting
WiFi still gets disabled
-
Check if the scripts are being triggered:
journalctl -f | grep ZenbookThen detach/attach the keyboard and watch for log entries.
-
If you don't see any logs, the udev rule might not be matching. Check your USB device IDs:
lsusb | grep -i asusMake sure it shows
0b05:1b2c. If different, update the udev rule. -
Make sure you replaced
samwith your actual username in both files!
Notifications not appearing
- Make sure you're running a notification daemon (mako, dunst, or swaync)
- Check if
notify-sendworks manually:notify-send "Test" "Hello"
Permission errors
If you see permission errors in logs, you might not be in the sudoers file. The scripts need to run as root to use rfkill.
Touchscreen input goes to wrong screen
If touches on the second screen register on the first screen (or vice versa), the device names might be different. Check your touchscreen devices:
hyprctl devices | grep -A 2 "Touch:"
Update the device names in ~/.config/hypr/input.conf to match your output.
Brightness controls don't work
The brightness commands target intel_backlight for the main screen. If your system uses a different backlight device, check available devices:
ls /sys/class/backlight/
Update the brightness bindings in ~/.config/hypr/bindings.conf to use your backlight device name.
Detached keyboard trackpad doesn't work
This is a Bluetooth pairing issue. The keyboard connects via Bluetooth when detached, but sometimes only the keyboard interface pairs, not the trackpad. Try:
- Re-pair the Bluetooth keyboard completely (remove and re-add in your Bluetooth settings)
- Detach and reattach the keyboard - sometimes it fixes itself on subsequent connections
How It Works
- udev detects when the keyboard USB device (vendor 0b05, product 1b2c) is added or removed
- The udev rule matches only ONE interface to avoid duplicate triggers (interface 1.0 for remove, interface 00 for add)
- Two scripts run in parallel:
- System script (as root): Runs
rfkill unblock wifito re-enable WiFi - User script (as your user):
- Enables/disables the second screen via
hyprctl - Sends desktop notifications
- Runs any custom Hyprland commands you add
- Enables/disables the second screen via
- System script (as root): Runs
- Scripts use
flockfor atomic locking to prevent race conditions if multiple events fire - Hyprland configuration:
- Monitor layout positions the second screen directly below the first (stacked)
- Touch device mappings ensure each touchscreen controls its respective display
- Media key bindings provide Super+F-key shortcuts since the Fn key doesn't work properly
Why the Kernel Fix Doesn't Work
The kernel fix (merged in 6.11) should suppress the spurious wireless toggle events from the asus-nb-wmi driver. However, even on kernel 6.16+, the fix doesn't reliably work on all Zenbook Duo units. This udev-based solution is more reliable and works regardless of kernel version.
Features Summary
✅ WiFi persistence - Automatically maintains WiFi connection during keyboard attach/detach ✅ Smart dual-screen - Second screen auto-enables when keyboard removed, auto-disables when attached ✅ Touch input mapping - Each touchscreen correctly mapped to its display ✅ Stacked layout - Monitors positioned top/bottom for natural tablet mode ✅ Media key support - Super+F-key bindings for volume, brightness, mute (since Fn doesn't work) ✅ Visual feedback - OSD popups for all media controls ✅ Desktop notifications - Know exactly when keyboard events occur ✅ Zero overhead - Event-driven, no background processes
Credits
Complete setup developed for ASUS Zenbook Duo UX8406MA running Arch Linux with Hyprland/Omarchy.
Tested on:
- Kernel: 6.16.8-arch3-1
- Displays: 2x 2880x1800@120Hz (Samsung)
- Omarchy (Arch-based Hyprland distribution)
License
Public domain. Use freely, modify as needed, share with others.
Contributing
Found an improvement or bug fix? Share it! This guide is meant to be a community resource for Zenbook Duo Linux users.