41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
// Session-local placement for Enfusion/Reforger test windows only.
|
|
var targetName = "HDMI-A-1";
|
|
var placing = false;
|
|
function isTestWindow(w) {
|
|
var app = String(w.resourceClass).toLowerCase();
|
|
return app === "steam_app_1874910" || app.indexOf("armareforger") >= 0 || String(w.caption).indexOf("Enfusion Workbench") >= 0;
|
|
}
|
|
function place(w) {
|
|
if (placing || !isTestWindow(w)) return;
|
|
placing = true;
|
|
var outputs = workspace.screens;
|
|
for (var i = 0; i < outputs.length; i++) {
|
|
if (outputs[i].name !== targetName) continue;
|
|
w.fullScreen = false;
|
|
w.setMaximize(false, false);
|
|
workspace.sendClientToScreen(w, outputs[i]);
|
|
var a = outputs[i].geometry;
|
|
var g = w.frameGeometry;
|
|
w.frameGeometry = {x: a.x + 20, y: a.y + 30,
|
|
width: Math.min(g.width, a.width - 40), height: Math.min(g.height, a.height - 60)};
|
|
print("ERRI_DISPLAY " + w.resourceClass + " -> " + w.output.name + " " + w.frameGeometry.x);
|
|
placing = false;
|
|
return;
|
|
}
|
|
w.minimized = true;
|
|
placing = false;
|
|
print("ERRI_DISPLAY target unavailable; test window minimized");
|
|
}
|
|
workspace.windowAdded.connect(function(w) {
|
|
place(w);
|
|
w.captionChanged.connect(function() { place(w); });
|
|
w.frameGeometryChanged.connect(function() { place(w); });
|
|
w.fullScreenChanged.connect(function() { place(w); });
|
|
});
|
|
var windows = workspace.windowList();
|
|
// Existing user editors are deliberately left untouched.
|
|
for (var i = 0; i < windows.length; i++) {
|
|
if (String(windows[i].caption).indexOf("Rereintroduced") >= 0) place(windows[i]);
|
|
}
|
|
print("ERRI_DISPLAY guard active for " + targetName);
|