Compositor: fix getFocusedWindowTitle. Since active workspace has been implemented.

+ autoformatting
This commit is contained in:
ItsLemmy
2025-09-29 15:04:13 -04:00
parent bb24b6904d
commit c53dd6fade
6 changed files with 47 additions and 39 deletions
+10 -10
View File
@@ -101,7 +101,7 @@ Item {
break
}
}
windowsList.push({
"id": win.id,
"title": win.title || "",
@@ -170,7 +170,7 @@ Item {
try {
const windowData = eventData.window
const existingIndex = windows.findIndex(w => w.id === windowData.id)
var output = null
for (var i = 0; i < workspaces.count; i++) {
if (workspaces.get(i).id === windowData.workspace_id) {
@@ -251,17 +251,17 @@ Item {
break
}
}
windowsList.push({
"id": win.id,
"title": win.title || "",
"appId": win.app_id || "",
"workspaceId": win.workspace_id || null,
"isFocused": win.is_focused === true,
"output": output,
"output": output
})
}
windowsList.sort((a, b) => a.id - b.id)
windows = windowsList
windowListChanged()
@@ -284,18 +284,18 @@ Item {
function handleWindowFocusChanged(eventData) {
try {
const focusedId = eventData.id
if (windows[focusedWindowIndex]) {
windows[focusedWindowIndex].isFocused = false
}
if (focusedId) {
const newIndex = windows.findIndex(w => w.id === focusedId)
if (newIndex >= 0) {
windows[newIndex].isFocused = true
}
focusedWindowIndex = newIndex >= 0 ? newIndex : -1
} else {
focusedWindowIndex = -1
@@ -315,7 +315,7 @@ Item {
Logger.error("NiriService", "Failed to switch workspace:", e)
}
}
function focusWindow(windowId) {
try {
Quickshell.execDetached(["niri", "msg", "action", "focus-window", "--id", windowId.toString()])
@@ -323,7 +323,7 @@ Item {
Logger.error("NiriService", "Failed to switch window:", e)
}
}
function closeWindow(windowId) {
try {
Quickshell.execDetached(["niri", "msg", "action", "close-window", "--id", windowId.toString()])