haimgel / display-switch

Turn a $30 USB switch into a full-featured multi-monitor KVM switch
https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
MIT License
2.86k stars 112 forks source link

Run a custom external command on input switch #69

Closed jichu4n closed 2 years ago

jichu4n commented 2 years ago

First off - thank you for this amazing tool! I use it everyday to switch between my work and personal computers and it's such a clever and practical solution.

One enhancement I'd like to propose is to add the ability to run a custom external command after the input switches to or away from the current device. In my particular use case, I'd use it to reconfigure mouse and keyboard sharing via Barrier. But I can imagine other use cases like locking the screen, putting the computer to sleep, etc.

Maybe something like

on_usb_connect = "Hdmi1"
on_usb_connect_run_command = "echo 'Connected!'"

Thanks!

haimgel commented 2 years ago

That's a neat idea, 👍

jichu4n commented 2 years ago

Wow thank you!! Really appreciate your time👍