2022-05-20 13:28:04 +00:00
|
|
|
import std.stdio;
|
|
|
|
import modules.monitors;
|
2022-05-20 15:21:10 +00:00
|
|
|
import core.thread;
|
2022-05-20 13:28:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Switching occurs only if 2 monitors are connected to the computer!
|
|
|
|
*/
|
|
|
|
|
|
|
|
int main(string[] args)
|
|
|
|
{
|
|
|
|
string path = "mswitch.log";
|
|
|
|
if (args.length > 1)
|
|
|
|
{
|
|
|
|
path = args[1];
|
|
|
|
}
|
|
|
|
auto file = File(path, "w");
|
|
|
|
|
|
|
|
auto monitors = getMonitorsInfo();
|
|
|
|
file.writeln(monitors);
|
2022-05-20 15:21:10 +00:00
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
setPrimaryMonitor(monitors[1].name);
|
|
|
|
file.writeln("-- Switch monitors --");
|
|
|
|
swapMonitors(monitors[0].name, monitors[1].name, Relation.right_of);
|
|
|
|
monitors = getMonitorsInfo();
|
|
|
|
file.writeln(monitors);
|
|
|
|
|
|
|
|
Thread.sleep(dur!("seconds")(10));
|
|
|
|
}
|
2022-05-20 13:28:04 +00:00
|
|
|
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|