aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/monitors/Mon.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-30 20:36:17 +0100
committerDanilo M. <danix@danix.xyz>2026-10-30 20:36:17 +0100
commit29d0c022b1557cef6b93efbc76734b816b92f62e (patch)
treea780be5c1704a18a2d9d8efcd5b965a215d9b006 /desktop/modules/monitors/Mon.js
parentffe1a7ccdd51f760fa1e742c0d09cc229a405544 (diff)
downloadquickshell-29d0c022b1557cef6b93efbc76734b816b92f62e.tar.gz
quickshell-29d0c022b1557cef6b93efbc76734b816b92f62e.zip
monitors: draw a scale being typed at 1
The page binds the canvas to size(), and an empty or partial scale gave Infinity or NaN and broke the fit. Apply is still held back until the scale is a positive number. Also marks the per-axis snap as a ceiling and checks a rotated scaled monitor and a two-monitor file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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) {