Thursday, April 04, 2024

Sharing a monitor between Linux & Mac

Desk with two monitors and laptop
For my new job, I (annoyingly) have to use a silly MacBook. For everything else, I have a nice, beautiful desktop running Fedora.

I looked into KVMs to share my monitor and keyboard between the two computers, but couldn't really find something reasonably priced and functional. 

Synergy/Barrier/InputLeap for keyboard sharing

I have used Synergy before to share keyboard and mouse between Linux computers, and this was already a good step. There is a fork for Synergy on Linux called Barrier, which now has been forked again to InputLeap. It also allows copy & paste between systems.

This brought me half to where I wanted to be, but I was still restricted to the tiny laptop screen on the Mac. 

DDC monitor input source switching

Both of my monitors are connected via DisplayPort to my desktop. I now connected the right monitor also via HDMI to the Mac. This already allowed me to easily switch between the input sources with the monitor's on-screen menu.

While researching a new monitor, which has a build in KVM, but only comes with software for Mac & Windows, I found out that you can control most monitor functionality via DCC. 

This includes things like brightness, contrast, rotation, and most importantly the input source. 

For Linux, you can use ddcutil and your window manager keyboard shortcut settings. For me, it is these two commands, your monitor and sources may vary.

ddcutil -d 1 setvcp 0x60 0x0f # display 1 -> displayport

ddcutil -d 1 setvcp 0x60 0x11 # display 1 -> hdmi

On OS X you can use BetterDisplay, this is a pretty nifty tool to control all kinds of aspects of your display, definitely worth a look. It also supports keyboard shortcuts to change input sources.

BetterDisplay screenshot

There you go, easy-peasy and for free. I hope that helps someone, or me in the future, when I forget how it works.

No comments:

Post a Comment