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

Don't switch source when already set #91

Closed adosikas closed 2 years ago

adosikas commented 2 years ago

When (re)starting the service, my monitor would flicker off while it re-applied the input.

Since there already was code to get the current source, I decided to add a check to skip setting the source if already set to the desired value.

Not really familiar with rust, so feel free to edit or make your own version.

Also, it might make sense to make this configurable, as mentioned in #30 and xkcd 1172.

craftyguy commented 2 years ago

I've been testing this (on Alpine Linux) and it seems to be working quite well! I hope it can be reviewed/merged soon 😄

thirtythreeforty commented 2 years ago

I just tested this and it doesn't work for me:

03:11:46 [INFO] Display 'DEL DELL P2719H 4H9RVS2' is currently set to Custom(0xf0f)

This is officially the monitor's fault, I think - 0xf0f is of course not what it was set to. However I don't know if some of these are option bits that need to be masked out (I am not familiar with the DDC commands in question).