display config: read live layout from hyprland instead of the cached wlr snapshot (#3418)

(cherry picked from commit d7b5812561)
This commit is contained in:
Harsh Kumar
2026-09-15 16:46:47 -04:00
committed by bbedward
parent e0aa1f0177
commit a5ffd18596
3 changed files with 44 additions and 1 deletions
@@ -1113,6 +1113,13 @@ Singleton {
}
}
Connections {
target: HyprlandService
function onMonitorLayoutChanged() {
root.outputs = root.buildOutputsMap();
}
}
Connections {
target: CompositorService
function onCompositorChanged() {
@@ -1806,6 +1813,13 @@ Singleton {
"transform": mapWlrTransform(output.transform)
}
};
const live = HyprlandService.liveMonitor(output.name);
if (!live)
continue;
map[output.name].logical.x = live.x;
map[output.name].logical.y = live.y;
map[output.name].logical.scale = live.scale || 1.0;
map[output.name].logical.transform = hyprlandToTransform(live.lastIpcObject?.transform ?? 0);
}
return map;
}
+1 -1
View File
@@ -275,7 +275,7 @@ Singleton {
enabled: isHyprland
function onRawEvent(event) {
if (event.name === "monitoraddedv2" || event.name === "monitorremoved") {
if (event.name === "monitoraddedv2" || event.name === "monitorremoved" || event.name === "configreloaded") {
root.refreshHyprlandMonitorLayout();
return;
}
+29
View File
@@ -21,6 +21,8 @@ Singleton {
readonly property bool luaConfigActive: CompositorService.isHyprland && (Hyprland.usingLua === true || luaConfigDetected)
property int _lastGapValue: -1
property string _monitorLayoutSignature: ""
signal monitorLayoutChanged
property bool luaConfigDetected: false
property bool luaConfigStatusReady: false
property bool luaConfigStatusLoading: false
@@ -296,11 +298,38 @@ Singleton {
Proc.runCommand("hyprctl-reload", ["hyprctl", "reload"], (output, exitCode) => {
if (exitCode !== 0)
log.warn("hyprctl reload failed:", output);
else
Hyprland.refreshMonitors();
if (callback)
callback(exitCode === 0);
});
}
function liveMonitor(name) {
if (!CompositorService.isHyprland)
return null;
return Hyprland.monitors.values.find(m => m.name === name) ?? null;
}
function _syncMonitorLayout() {
const signature = Hyprland.monitors.values.map(m => `${m.name}:${m.x},${m.y},${m.scale},${m.lastIpcObject?.transform ?? 0}`).join("|");
if (signature === _monitorLayoutSignature)
return;
_monitorLayoutSignature = signature;
monitorLayoutChanged();
}
Instantiator {
model: CompositorService.isHyprland ? Hyprland.monitors : null
delegate: Connections {
required property HyprlandMonitor modelData
target: modelData
function onLastIpcObjectChanged() {
root._syncMonitorLayout();
}
}
}
function setLayoutXray(enabled) {
layoutXrayEnabled = enabled;
_layoutXrayLoaded = true;