1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

niri: add workspace assignment helper

This commit is contained in:
bbedward
2025-10-27 20:20:34 -04:00
parent b6688adb35
commit 3c049e031f

View File

@@ -39,6 +39,11 @@ Singleton {
signal windowUrgentChanged
function setWorkspaces(newMap) {
root.workspaces = newMap
allWorkspaces = Object.values(newMap).sort((a, b) => a.idx - b.idx)
}
Component.onCompleted: fetchOutputs()
Timer {
@@ -280,8 +285,7 @@ Singleton {
}
}
root.workspaces = newWorkspaces
allWorkspaces = Object.values(newWorkspaces).sort((a, b) => a.idx - b.idx)
setWorkspaces(newWorkspaces)
focusedWorkspaceIndex = allWorkspaces.findIndex(w => w.is_focused)
if (focusedWorkspaceIndex >= 0) {
@@ -325,18 +329,15 @@ Singleton {
updatedWorkspaces[id] = updatedWs
}
root.workspaces = updatedWorkspaces
setWorkspaces(updatedWorkspaces)
focusedWorkspaceId = data.id
focusedWorkspaceIndex = Object.values(updatedWorkspaces).findIndex(w => w.id === data.id)
focusedWorkspaceIndex = allWorkspaces.findIndex(w => w.id === data.id)
if (focusedWorkspaceIndex >= 0) {
const ws = Object.values(updatedWorkspaces)[focusedWorkspaceIndex]
currentOutput = ws.output || ""
currentOutput = allWorkspaces[focusedWorkspaceIndex].output || ""
}
allWorkspaces = Object.values(updatedWorkspaces).sort((a, b) => a.idx - b.idx)
updateCurrentOutputWorkspaces()
}
@@ -377,7 +378,7 @@ Singleton {
for (const id in root.workspaces) {
updatedWorkspaces[id] = id === focusedWindow.workspace_id ? updatedWs : root.workspaces[id]
}
root.workspaces = updatedWorkspaces
setWorkspaces(updatedWorkspaces)
}
}
}
@@ -395,7 +396,7 @@ Singleton {
for (const id in root.workspaces) {
updatedWorkspaces[id] = id === data.workspace_id ? updatedWs : root.workspaces[id]
}
root.workspaces = updatedWorkspaces
setWorkspaces(updatedWorkspaces)
}
const updatedWindows = []
@@ -533,9 +534,7 @@ Singleton {
for (const id in root.workspaces) {
updatedWorkspaces[id] = id === data.id ? updatedWs : root.workspaces[id]
}
root.workspaces = updatedWorkspaces
allWorkspaces = Object.values(updatedWorkspaces).sort((a, b) => a.idx - b.idx)
setWorkspaces(updatedWorkspaces)
windowUrgentChanged()
}