Stengo / DeskPad

A virtual monitor for screen sharing
MIT License
5.31k stars 93 forks source link

Use processIdentifier to allow multiple screens #27

Closed ghost closed 2 weeks ago

ghost commented 6 months ago

Closes #20

You can have multiple screens by either copying the app or by using open -n /Applications/DeskPad.app

But brings in a new set of problems..

I also barely tested this (due to macOS permissions being problematic when running from xcode), but I'll probably have a couple of real-world use-cases in the next couple of months where I'll actually test this.


I'm not a swift coder, so this is just the bare minimum to get the ball rolling.

I've also tried or thought about other strategies for display-names / serial numbers:

I think the best option would be to allow configuring the amount of displays the user wants for a single instance. However, I don't know enough swift to actually work on this myself.

Hopefully someone is being nerd-sniped here to actually work on a proper implementation.

agreenbhm commented 5 months ago

I made a similar mod, though it has a static number of screens (4) rather than dynamic. I originally used a random number for the serial number which resulted in the arrangement not being stored since MacOS viewed each screen as different than it had previously seen. I ended up statically assigning serial numbers (1, 2, 3 ,4) so that they all go back to the previous arrangement.

Your setup is similar to my original problem with the arrangement due to the serial number being based on PID. I'd suggest instead of doing it on PID that you instead identify which instance number you have open, something along the lines of (pseudocode):

$serialNumber = $(listProcesses | find Deskpad | count) + 1

This way the serial numbers will be the same each time and you will retain your screen arrangement.

If you'd prefer a static number of screens, see my fork (which you can tweak to be +/- the 4 I have currently set. https://github.com/agreenbhm/DeskPad