mswitch/source/app.d

29 lines
601 B
D
Raw Normal View History

2022-05-20 13:28:04 +00:00
import std.stdio;
import modules.monitors;
/**
* 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);
setPrimaryMonitor(monitors[1].name);
file.writeln("-- Switch monitors --");
swapMonitors(monitors[0].name, monitors[1].name, Relation.right_of);
monitors = getMonitorsInfo();
file.writeln(monitors);
file.close();
return 0;
}