Giter Site home page Giter Site logo

display-switch's Introduction

Turn a $30 USB switch into a full-featured KVM

This utility watches for USB device connect/disconnect events and switches monitor inputs via DDC/CI. This turns a simple USB switch into a full-fledged KVM solution: press one button on your USB switch and all your monitors connect to a different input.

It is supposed to be installed on all computers that could be connected to these monitors, since the app only switches monitors "one way" and relies on itself running on the other computers to switch it "the other way" as needed.

Platforms supported

The app is written twice: once for MacOS (in Swift) and once for Windows (in Rust). The idea is dead simple, but I haven't found good cross-platform support for DDC, USB, device plug-n-play and power management in any one language except C, and I didn't want to write this in C.

Configuration

The configuration is pretty similar on both platforms:

On MacOS: the configuration file is expected in ~/Library/Preferences/display-switch.ini On Windows: the configuration file is expected in /Users/USERNAME/AppData/Roaming/display-switch/display-switch.ini

Configuration file settings:

  usb_device = "1050:0407"
  monitor_input = "Hdmi1"

usb_device is which USB device to watch (vendor id / device id in hex), and monitor_input is which monitor input to switch to, when this device is connected. Supported values are Hdmi1, Hdmi2, DisplaySwitch1, DisplaySwitch2 If your monitor has an USB-C port, it's usually reported as DisplaySwitch2

Logging

On MacOS: the log file is written to the system log. On WindowS: the log file is written to /Users/USERNAME/AppData/Local/display-switch/display-switch.log

Building from source

Windows

Install Rust, then do cargo build --release from inside Windows directory.

MacOS

Install Xcode, then do xcodebuild -scheme display_switch -configuration release -derivedDataPath .build build from inside MacOS directory.

Running on startup

Windows

Copy display_switch.exe from target\release (where it was built in the previous step) to C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup (replace Username with your Windows user name).

MacOS

  # Get your INI file in order! (see above)
  cp .build/Build/Products/Release/display_switch /usr/local/bin
  cp dev.haim.display-switch.daemon.plist ~/Library/LaunchAgents/
  launchctl load ~/Library/LaunchAgents/dev.haim.display-switch.daemon.plist

display-switch's People

Contributors

haimgel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.