fix(labwc): minor fixes to support upstream ext-workspace-v1

This commit is contained in:
Lemmy
2026-03-18 09:43:20 -04:00
parent 739d84a214
commit bbee20a1a6
+30 -13
View File
@@ -31,22 +31,40 @@ Item {
updateWindows(); updateWindows();
connectWorkspaceSignals(); connectWorkspaceSignals();
syncWorkspaces(); syncWorkspaces();
Logger.i("LabwcService", "Service started (native ext-workspace-v1)"); Logger.i("LabwcService", "Service started (ext-workspace-v1)");
} }
// Watch for workspaces being added/removed from the model // Watch for windowsets being added/removed
Connections { Connections {
target: WindowManager.workspaces target: WindowManager
function onValuesChanged() { function onWindowsetsChanged() {
root.connectWorkspaceSignals(); root.connectWorkspaceSignals();
Qt.callLater(root.syncWorkspaces); Qt.callLater(root.syncWorkspaces);
} }
function onWindowsetProjectionsChanged() {
Qt.callLater(root.syncWorkspaces);
}
} }
// Connect to property change signals on each native workspace object // Re-check windowsets after a short delay - the Wayland protocol data
// may arrive after init and the changed signal can be missed
Timer {
interval: 500
running: true
repeat: false
onTriggered: {
if (WindowManager.windowsets.length > 0) {
root.connectWorkspaceSignals();
root.syncWorkspaces();
}
}
}
// Connect to property change signals on each native windowset object
function connectWorkspaceSignals() { function connectWorkspaceSignals() {
const nativeWs = WindowManager.workspaces.values; const nativeWs = WindowManager.windowsets;
const newConnected = {}; const newConnected = {};
for (const ws of nativeWs) { for (const ws of nativeWs) {
@@ -77,8 +95,7 @@ Item {
} }
function syncWorkspaces() { function syncWorkspaces() {
const nativeWs = WindowManager.workspaces.values; const nativeWs = WindowManager.windowsets;
const groups = WindowManager.workspaceGroups.values;
workspaces.clear(); workspaces.clear();
nativeWorkspaceMap = {}; nativeWorkspaceMap = {};
@@ -91,12 +108,12 @@ Item {
continue; continue;
} }
// Find which outputs this workspace's group spans // Find which outputs this windowset's projection spans
let outputName = ""; let outputName = "";
if (ws.group) { if (ws.projection) {
const groupScreens = ws.group.screens; const projScreens = ws.projection.screens;
if (groupScreens && groupScreens.length > 0) { if (projScreens && projScreens.length > 0) {
outputName = groupScreens[0].name || ""; outputName = projScreens[0].name || "";
} }
} }