mswitch/source/app.d

36 lines
715 B
D

import std.stdio;
import modules.monitors;
import core.thread;
/**
* 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);
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));
}
file.close();
return 0;
}