EDIT see my comment below which uses a much cleaner method that avoids the noisy multple udev events and doesn't require udev/eudev at all
This activates/de-activates the secondary display underneath the removeable keyboard properly. Note though that the keyboard is a composite unit and causes a whole train of udev events, rather than a single one, which means the desktop will flicker multiple times on each re-attachment of the keyboard :(. If anyone knows how to just run the scripts on the 'last' udev event, it would make for a cleaner experience. (XFCE sometimes crashes out on me due to the rapid xrandr reconfigs but it's mostly usable).
[/usr/local/bin/usb-0b05_1b2c-in]
#!/bin/bash
if [ "$(xrandr --listmonitors | wc -l)" -gt "2" ]; then
#logger -p user.info "=== KEYBOARD REPLACED ==="
xrandr --output eDP-2 --off
fi
[/usr/local/bin/usb-0b05_1b2c-in_udev]
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
/usr/local/bin/usb-0b05_1b2c-in &
[/usr/local/bin/usb-0b05_1b2c-out]
#!/bin/bash
if [ "$(xrandr --listmonitors | wc -l)" -lt "3" ]; then
#logger -p user.info "=== KEYBOARD REMOVED ==="
xrandr --auto && xrandr --output eDP-2 --below eDP-1
fi
[/usr/local/bin/usb-0b05_1b2c-out_udev]
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
/usr/local/bin/usb-0b05_1b2c-out &
[/etc/udev/rules.d/99-zbduo2024-kbd.rules]
ACTION=="add", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1b2c", ENV{XAUTHORITY}="/home/username/.Xauthority", ENV{DISPLAY}=":0", OWNER="username", RUN+="/usr/local/bin/usb-0b05_1b2c-in_udev"
ACTION=="remove", ENV{ID_MODEL}="ASUS_Zenbook_Duo_Keyboard", RUN+="/usr/local/bin/usb-0b05_1b2c-out_udev"
Now, to get your laptop keyboard working when removed, in bluetooth mode, one must
- Ensure bluetooth-ctl is running and initiate 'pair' in Bluetooth by clicking 'Create pairing with this device' (key icon in the 'Blueman-Manager' window)
- Turn on bluetooth (switch on the left of the keyboard)
- Remove the keyboard
- Hold F10 for 4-5 seconds until its blue LED starts blinking rapidly (kbd in pairing mode)
- Watch your desktop notifications for the connection message with the BT challenge pin code (6 digits)
- type the challenge PIN code on the keyboard
- Now the keyboard should be paired.
... now if only I could get the sound device (Intel HD Audio) and brightness control working for both screens!
Canada needs to hit back HARD with counter-tariffs. If we cave here, then where will it end??
Trump thinks he can unilaterally pull out of NAFTA (or whatever the modern equivalent is)? OK, we can unilaterally pull out of the water treaties that say we allow our rivers to flow south of the border.
The time has come for Canada to stop exporting any raw resources at all. Water, lumber, cattle, crude, LNG ... keep it and refine/process it and sell finished goods only.
Canadians may have forgotten how quickly the US caved on keeping cattle from being imported to the northern US states for processing when Alberta and Saskatchewan called their bluff near the end of the Mad Cow scare around 2003... Canada had all the paperwork to prove herds were being tested properly for mad cow disease, but the US wanted to leverage the fear to keep Canadian beef out to help their own farmers; so Canada decided to start building more beef processing plants locally. They panicked and re-opened exports fearing we'd become self-sufficient for beef production and stop sending our cattle to them for good, destroying their processing industry.