From 91569affd7c890619642e1812b948b4d07693222 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 9 Feb 2026 09:49:31 -0500 Subject: [PATCH] displays: update mango display config syntax fixes #1629 --- .../DisplayConfig/DisplayConfigState.qml | 36 ++++++++++++------- quickshell/Services/DwlService.qml | 5 +-- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/quickshell/Modules/Settings/DisplayConfig/DisplayConfigState.qml b/quickshell/Modules/Settings/DisplayConfig/DisplayConfigState.qml index 3fdfbbc2..8ea1671e 100644 --- a/quickshell/Modules/Settings/DisplayConfig/DisplayConfigState.qml +++ b/quickshell/Modules/Settings/DisplayConfig/DisplayConfigState.qml @@ -624,28 +624,40 @@ Singleton { const result = {}; const lines = content.split("\n"); for (const line of lines) { - const match = line.match(/^\s*monitorrule=([^,]+),([^,]+),([^,]+),([^,]+),(\d+),([\d.]+),(-?\d+),(-?\d+),(\d+),(\d+),(\d+)/); - if (!match) + const trimmed = line.trim(); + if (!trimmed.startsWith("monitorrule=")) continue; - const name = match[1].trim(); + + const params = {}; + for (const pair of trimmed.substring("monitorrule=".length).split(",")) { + const colonIdx = pair.indexOf(":"); + if (colonIdx < 0) + continue; + params[pair.substring(0, colonIdx).trim()] = pair.substring(colonIdx + 1).trim(); + } + + const name = params.name; + if (!name) + continue; + result[name] = { "name": name, "logical": { - "x": parseInt(match[7]), - "y": parseInt(match[8]), - "scale": parseFloat(match[6]), - "transform": mangoToTransform(parseInt(match[5])) + "x": parseInt(params.x || "0"), + "y": parseInt(params.y || "0"), + "scale": parseFloat(params.scale || "1"), + "transform": mangoToTransform(parseInt(params.rr || "0")) }, "modes": [ { - "width": parseInt(match[9]), - "height": parseInt(match[10]), - "refresh_rate": parseInt(match[11]) * 1000 + "width": parseInt(params.width || "1920"), + "height": parseInt(params.height || "1080"), + "refresh_rate": parseFloat(params.refresh || "60") * 1000 } ], "current_mode": 0, - "vrr_enabled": false, - "vrr_supported": false + "vrr_enabled": parseInt(params.vrr || "0") === 1, + "vrr_supported": true }; } return result; diff --git a/quickshell/Services/DwlService.qml b/quickshell/Services/DwlService.qml index 4b93b87b..564e5619 100644 --- a/quickshell/Services/DwlService.qml +++ b/quickshell/Services/DwlService.qml @@ -298,7 +298,7 @@ Singleton { function generateOutputsConfig(outputsData) { if (!outputsData || Object.keys(outputsData).length === 0) return; - let lines = ["# Auto-generated by DMS - do not edit manually", "# VRR is global: set adaptive_sync=1 in config.conf", ""]; + let lines = ["# Auto-generated by DMS - do not edit manually", ""]; for (const outputName in outputsData) { const output = outputsData[outputName]; @@ -320,8 +320,9 @@ Singleton { const y = output.logical?.y ?? 0; const scale = output.logical?.scale ?? 1.0; const transform = transformToMango(output.logical?.transform ?? "Normal"); + const vrr = output.vrr_enabled ? 1 : 0; - const rule = [outputName, "0.55", "1", "tile", transform, scale, x, y, width, height, refreshRate].join(","); + const rule = ["name:" + outputName, "width:" + width, "height:" + height, "refresh:" + refreshRate, "x:" + x, "y:" + y, "scale:" + scale, "rr:" + transform, "vrr:" + vrr].join(","); lines.push("monitorrule=" + rule); }