1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-02-14 12:21:50 +00:00

XRandR: automatic screen selection if doesn't exist

This commit is contained in:
Bumsik Kim 2018-05-10 21:06:45 -04:00
parent ca6ec24d49
commit be5e4da1aa
No known key found for this signature in database
GPG key ID: E31041C8EC5B01C6

View file

@ -178,6 +178,13 @@ class XRandR(SubprocessWrapper):
print("\t", s)
if self.virt_idx == self.primary_idx:
raise RuntimeError("VIrtual screen must be selected other than the primary screen")
if self.virt_idx is None:
for idx, screen in enumerate(self.screens):
if not screen.connected and not screen.active:
self.virt_idx = idx
break
if self.virt_idx is None:
raise RuntimeError("There is no available devices for virtual screen")
self.virt = self.screens[self.virt_idx]
self.primary = self.screens[self.primary_idx]