aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/monitors/Mon.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/monitors/Mon.js')
-rw-r--r--desktop/modules/monitors/Mon.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/desktop/modules/monitors/Mon.js b/desktop/modules/monitors/Mon.js
index 9b5e158..865e155 100644
--- a/desktop/modules/monitors/Mon.js
+++ b/desktop/modules/monitors/Mon.js
@@ -52,12 +52,14 @@ function draft(m) {
position: m.x + "x" + m.y, x: m.x, y: m.y };
}
-// Logical size: an odd transform is a quarter turn, scale divides.
+// Logical size: an odd transform is a quarter turn, scale divides. A scale
+// being typed ("", "1.") draws at 1 until it is a positive number.
function size(mode, scale, transform) {
const p = /^(\d+)x(\d+)/.exec(mode);
+ const k = +scale > 0 ? +scale : 1;
let w = +p[1], h = +p[2];
if (transform % 2) { const t = w; w = h; h = t; }
- return { w: w / +scale, h: h / +scale };
+ return { w: w / k, h: h / k };
}
// The layout position: exact XxY, or where Hyprland last put an auto one.
@@ -90,6 +92,9 @@ function nearest(v, cands, t) {
// r ({x, y, w, h}, logical) moved so an edge within t lies on an edge of one
// of others: beside it, or aligned with it. Each axis on its own, rounded.
+// ponytail: an axis snaps to a monitor however far off it is on the other
+// axis, and overlaps are not refused; right for two monitors, check both
+// axes together if a third is added.
function snap(r, others, t) {
const xs = [], ys = [];
for (const o of others) {