#!/bin/bash # KVM Switch: Mac → Nobara # Switches monitor to HDMI 2 and peripherals to Channel 2 (Nobara Bolt) # # Channel setup: # Channel 2 (0x01): Bolt #1 → Nobara # Channel 3 (0x02): Bolt #2 → Mac (via monitor USB hub) set -e HIDAPITESTER="$HOME/bin/hidapitester" echo "Switching to Nobara..." # 1. Switch Monitor to HDMI 2 (Dell U3821DW input code: 18) echo " Monitor -> HDMI 2..." if ! m1ddc set input 18 2>/dev/null; then echo " [WARN] Monitor switch failed (DDC/CI disabled or not connected via USB-C)" fi # 2. Switch Mouse (MX Master 3S) to Channel 2 (Nobara Bolt) # Device index 0x01 - adjust if mouse was paired in different order echo " Mouse -> Channel 2..." "$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \ --open --length 7 --send-output 0x10,0x01,0x09,0x1b,0x01,0x00,0x00 2>/dev/null || \ echo " [WARN] Mouse switch failed" # 3. Switch Keyboard (MX Keys S) to Channel 2 (Nobara Bolt) # Device index 0x02 - adjust if keyboard was paired in different order echo " Keyboard -> Channel 2..." "$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \ --open --length 7 --send-output 0x10,0x02,0x09,0x1b,0x01,0x00,0x00 2>/dev/null || \ echo " [WARN] Keyboard switch failed" echo "Done!"