I just recently started experimenting with an arch+hyperland-based linux distribution called Omarchy, installed on a mini desktop computer Beelink SER8.
Now i’m exploring how switch forth and back between Mac and Linux in a breathe.
I’m using Logitechs MX Mechanical Mini and MX Master 3S with a Bolt Receiver on both my Mac and Linux. (Paired both receivers with Mac, one with Device 1 on both Mouse and Keyboard, the other with Device 2).
Since it is cumbersome to hit the easy switch buttons physically (especially underneath the mouse), I want a global hotkey on both systems to toggle the inputs. To get a native experience, i did not want to use a virtual kvm.
Switching from Mac
This was really easy. Download hidapitester and make it available in your path. (I had to download arm64, for my MacBook Air M2.
sudo mv hidapitester /usr/local/bin/
Then create a bash script that makes the switch. Worked on the first attempt.
~/Code/to-oma.sh
#!/bin/bash
hidapitester --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
hidapitester --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00
Symlink
sudo ln -s ~/Code/to-oma.sh /usr/local/bin/toma
Hotkey
In order to make it available under a global hotkey, I created a MacOS Shortcut.

But the hotkey defined here isn’t really working globally, so i set a hotkey on the Snapshot from within Alfred Extensions, which now works reliably from everywhere:

Switching from Linux
While hidapitester is available for linux, i could not get it working. It would simply not switch.
Next up i tried Solaar which managed to switch the devices, but it took 7 seconds for the switch to happen. Digging into how Solaar does it with the help of claude code this pyhon script does the job almost instantly:
#!/usr/bin/env python3
def send_hidpp_command(device_path, device_id, feature_id, function_id, params=[]):
"""Send HID++ 2.0 command directly to device"""
# HID++ 2.0 long report format: 0x11 device_id feature_id function_id params...
report = [0x11, device_id, feature_id, function_id] + params + [0x00] * (20 - 4 - len(params))
with open(device_path, 'wb') as f:
f.write(bytes(report))
def switch_host():
device_path = "/dev/hidraw2"
# Switch MX Master 3S - try both device 1 and 2 (one might be offline)
try:
send_hidpp_command(device_path, 0x01, 0x0A, 0x10, [0x00]) # device 1, feature index 10
except:
pass
try:
send_hidpp_command(device_path, 0x02, 0x0A, 0x10, [0x00]) # device 2, feature index 10
except:
pass
# Switch MX Mechanical Mini (device 3) to host 1 (index 0)
send_hidpp_command(device_path, 0x03, 0x09, 0x10, [0x00]) # feature index 9, function 0x10, host 0
if __name__ == "__main__":
switch_host()
Hotkey
Setting up a global hotkey in omarchy/hyprland is very simple.
~/.config/hypr/bindings.conf
Just add a binding in bindings.conf:
bindd = CONTROL, Y, Switch to Mac, exec, $terminal --class=tmac-modal -e sh -c '/home/lco/.local/bin/tmac && exit || read -p "Failed! Press Enter to close..."'
Now i can switch my inputs forth and back with CONTROL+J on both devices.
The hotkey launching script is a little longer, because i combined it with a window rule that displays the terminal as a modal (only if it fails switching). You might just want to trust the script and run it without actually launching a terminal window.
Next up
- Monitor: currently i’m running with a split screen. Would like to be able to make the monitor switch between split or fullscreen on either Mac or Omarchy
- Clipboard sync
- Camera/Headset (no idea how that could work yet)