Swithcing monitor input source with hotkey

Some setup for the main question:
I have a laptop (Linux/Windows) and a PC (Windows). I’ve connected these two to a single USB hub so that I can use the same keyboard and mouse for both systems with one button press in the USB hub. I also share my main monitor (Dell U2713HM) with these systems and I need to change the input source when ever I want to change the system (HDMI to laptop, DVI to PC).

Actual question:
Can I change the input source changing to a single hotkey or make it a smoother experience in any way?

Not sure if this is the right category for this

1 Like

Most likely there isn’t any interfacing with the monitor and keyboard. I think the proper solution to your problem is a KVM which Level1 just so happens to sell.

If you really wanted to do it on the cheap you may be able to fake a button press on the monitor with an Arduino or something but that may take some time to figure out.

ddcutil is the linux package to do this, but it only works with modern monitors. there’s some i2c hardware devices that can do it on older ones that don’t comply to the new command standards.

we’ve written a short script to achieve this over at https://www.passthroughpo.st

The github is here:

article is here:

@mail929 maybe do a little research first.

3 Likes

Had no idea something like this existed… my monitor even has support for it, thanks for pointing it out.

yeah it’s a not-super-well-known standard. There’s even competing ones that are mainly implemented in TVs

Using what @tkoham has posted above (many thanks!) I made the following script which I map to a hotkey.

#!/bin/sh

TOGGLE=~/.toggle

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    sudo ddcutil -d 1 setvcp 60 0x11
else
    rm $TOGGLE
    sudo ddcutil -d 1 setvcp 60 0x3
fi

As I switch between inputs while the guest is running, this works better for me than a hook script.

1 Like

How can I map a script to a hotkey? Tried to get xbindkeys to work with a script but couldn’t do that for some reason.

Otherwise @tkoham 's tutorial has been perfect!

you can bind hotkeys to .sh scripts in most popular DEs (gnome, xfce, kde, and compiz)

the option is usually in the keyboard settings

using xbindkeys, make sure the script has executable permissions.

IIRC xbindkeys WILL NOT work in wayland

1 Like

Yep… This is what I did in gnome :+1: