mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-15 18:22:08 -04:00
@@ -624,28 +624,40 @@ Singleton {
|
|||||||
const result = {};
|
const result = {};
|
||||||
const lines = content.split("\n");
|
const lines = content.split("\n");
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const match = line.match(/^\s*monitorrule=([^,]+),([^,]+),([^,]+),([^,]+),(\d+),([\d.]+),(-?\d+),(-?\d+),(\d+),(\d+),(\d+)/);
|
const trimmed = line.trim();
|
||||||
if (!match)
|
if (!trimmed.startsWith("monitorrule="))
|
||||||
continue;
|
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] = {
|
result[name] = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"logical": {
|
"logical": {
|
||||||
"x": parseInt(match[7]),
|
"x": parseInt(params.x || "0"),
|
||||||
"y": parseInt(match[8]),
|
"y": parseInt(params.y || "0"),
|
||||||
"scale": parseFloat(match[6]),
|
"scale": parseFloat(params.scale || "1"),
|
||||||
"transform": mangoToTransform(parseInt(match[5]))
|
"transform": mangoToTransform(parseInt(params.rr || "0"))
|
||||||
},
|
},
|
||||||
"modes": [
|
"modes": [
|
||||||
{
|
{
|
||||||
"width": parseInt(match[9]),
|
"width": parseInt(params.width || "1920"),
|
||||||
"height": parseInt(match[10]),
|
"height": parseInt(params.height || "1080"),
|
||||||
"refresh_rate": parseInt(match[11]) * 1000
|
"refresh_rate": parseFloat(params.refresh || "60") * 1000
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"current_mode": 0,
|
"current_mode": 0,
|
||||||
"vrr_enabled": false,
|
"vrr_enabled": parseInt(params.vrr || "0") === 1,
|
||||||
"vrr_supported": false
|
"vrr_supported": true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ Singleton {
|
|||||||
function generateOutputsConfig(outputsData) {
|
function generateOutputsConfig(outputsData) {
|
||||||
if (!outputsData || Object.keys(outputsData).length === 0)
|
if (!outputsData || Object.keys(outputsData).length === 0)
|
||||||
return;
|
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) {
|
for (const outputName in outputsData) {
|
||||||
const output = outputsData[outputName];
|
const output = outputsData[outputName];
|
||||||
@@ -320,8 +320,9 @@ Singleton {
|
|||||||
const y = output.logical?.y ?? 0;
|
const y = output.logical?.y ?? 0;
|
||||||
const scale = output.logical?.scale ?? 1.0;
|
const scale = output.logical?.scale ?? 1.0;
|
||||||
const transform = transformToMango(output.logical?.transform ?? "Normal");
|
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);
|
lines.push("monitorrule=" + rule);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user