MolotovCherry / virtual-display-rs

A Windows virtual display driver to add multiple virtual monitors to your PC! For Win10+. Works with VR, obs, streaming software, etc
MIT License
473 stars 39 forks source link

Clean up CLI for adding/removing modes and monitors #97

Closed kylewlacy closed 3 months ago

kylewlacy commented 3 months ago

This PR should close out the final pieces from https://github.com/MolotovCherry/virtual-display-rs/issues/48, namely these bullet points:

  • For add/add-mode/remove-mode, allow specifying custom refresh rates per monitor mode. Making it clearer to type is also a bonus. - comment
  • Deprecate mode indexes and allow selection of monitors by unique WIDTH/HEIGHT. Potentially also allow deleting only refresh rate instead of entire mode. - comment. UX TBD

Basically, adding a monitor or mode now uses a compact string, so these are all valid commands:

Removing modes uses the same string format, but there's one small difference: if you leave off the refresh rate, it removes all modes (not just @60)

I also tweaked add-mode, remove, and remove-mode to support using a monitor's name instead of its ID. So, this series of commands should work:

virtual-display-driver-cli.exe add --name foo 3840x2160
virtual-display-driver-cli.exe add-mode foo 1920x1080@60/90 
virtual-display-driver-cli.exe remove-mode foo 1920x1080
virtual-display-driver-cli.exe remove foo

(Also, I really should've opened this PR earlier... I originally wrote all this code in December but forgot to submit it, sorry!)

MolotovCherry commented 3 months ago

Thanks a lot! I'll test this out in a moment.

Btw, I remember you talked earlier about scripting. You'll be glad to know that I plan to make some bindings for languages, e.g. Python, so it's fully scriptable. A great way to allow full customizability with scripts (instead of trying to parse a cli)

MolotovCherry commented 3 months ago

Looks great! Thank you for taking the time to do this, I appreciate it <3