development

This commit is contained in:
Alexander Zhirov 2022-05-20 18:21:10 +03:00
parent 61df35ee17
commit 056f01658b
2 changed files with 13 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.o *.o
mswitch mswitch
mswitch.log

View File

@ -1,5 +1,6 @@
import std.stdio; import std.stdio;
import modules.monitors; import modules.monitors;
import core.thread;
/** /**
* Switching occurs only if 2 monitors are connected to the computer! * Switching occurs only if 2 monitors are connected to the computer!
@ -16,11 +17,17 @@ int main(string[] args)
auto monitors = getMonitorsInfo(); auto monitors = getMonitorsInfo();
file.writeln(monitors); file.writeln(monitors);
setPrimaryMonitor(monitors[1].name);
file.writeln("-- Switch monitors --"); while (true)
swapMonitors(monitors[0].name, monitors[1].name, Relation.right_of); {
monitors = getMonitorsInfo(); setPrimaryMonitor(monitors[1].name);
file.writeln(monitors); file.writeln("-- Switch monitors --");
swapMonitors(monitors[0].name, monitors[1].name, Relation.right_of);
monitors = getMonitorsInfo();
file.writeln(monitors);
Thread.sleep(dur!("seconds")(10));
}
file.close(); file.close();