Hardware Setup

  • Mac connected via USB-C (video + USB hub uplink)
  • Linux PC connected via DisplayPort (video) + USB-B (USB hub uplink)
  • Logitech receiver plugged into a USB-A downstream port on the monitor
  • KVM configured in Dell OSD: Others → USB Selection — USB-C upstream linked to USB-C input, USB-B upstream linked to DP input

This makes the monitor's USB hub (and thus keyboard/mouse) follow the active display input automatically.

Mac Side — Automator Quick Action + m1ddc

Install m1ddc:

bash
brew install m1ddc

Create the shortcut:

  1. Open Automator → New → Quick Action
  2. Set "Workflow receives" to no input, in any application
  3. Add a Run Shell Script action, shell: /bin/zsh
  4. Script content:
bash
/opt/homebrew/bin/m1ddc set input 15
  1. Save as e.g. "Switch to PC"

Assign keyboard shortcut: System Settings → Keyboard → Keyboard Shortcuts → Services → General — find "Switch to PC" and assign e.g. ⌥⌘P

Linux Side — ddcutil + XFCE Keyboard Shortcut

Install ddcutil and add user to i2c group:

bash
sudo apt install ddcutil
sudo usermod -aG i2c $USER

Log out and back in.

Assign keyboard shortcut: XFCE Settings → Keyboard → Application Shortcuts → Add:

bash
/usr/bin/ddcutil setvcp 60 0x19

Assign the same or equivalent shortcut, e.g. Ctrl+Alt+P

Input Source Reference

Input Code
DisplayPort (Linux PC) 0x0f (15)
USB-C (Mac) 0x19 (25)

Result

One keypress on either machine switches display input, keyboard, and mouse simultaneously.