mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Compositor: fix getFocusedWindowTitle. Since active workspace has been implemented.
+ autoformatting
This commit is contained in:
@@ -117,12 +117,12 @@ Singleton {
|
||||
// Emit signal to notify listeners that workspace list has been updated
|
||||
workspacesChanged()
|
||||
}
|
||||
|
||||
|
||||
function syncWindows() {
|
||||
windows.clear()
|
||||
const ws = backend.windows
|
||||
for (var i = 0; i < ws.length; i++) {
|
||||
windows.append(ws[i])
|
||||
windows.append(ws[i])
|
||||
}
|
||||
// Emit signal to notify listeners that workspace list has been updated
|
||||
windowListChanged()
|
||||
@@ -131,7 +131,7 @@ Singleton {
|
||||
// Get window title for focused window
|
||||
function getFocusedWindowTitle() {
|
||||
if (focusedWindowIndex >= 0 && focusedWindowIndex < windows.count) {
|
||||
return windows[focusedWindowIndex].title || ""
|
||||
return windows.get(focusedWindowIndex).title || ""
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -155,7 +155,7 @@ Singleton {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
// Get active workspaces
|
||||
function getActiveWorkspaces() {
|
||||
const activeWorkspaces = []
|
||||
@@ -167,7 +167,7 @@ Singleton {
|
||||
}
|
||||
return activeWorkspaces
|
||||
}
|
||||
|
||||
|
||||
// Set focused window
|
||||
function focusWindow(windowId) {
|
||||
if (backend && backend.focusWindow) {
|
||||
@@ -184,7 +184,7 @@ Singleton {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
// Close window
|
||||
function closeWindow(windowId) {
|
||||
if (backend && backend.closeWindow) {
|
||||
|
||||
@@ -277,7 +277,7 @@ Item {
|
||||
Logger.error("HyprlandService", "Failed to switch workspace:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function focusWindow(windowId) {
|
||||
try {
|
||||
Hyprland.dispatch(`focuswindow ${windowId}`)
|
||||
@@ -285,7 +285,7 @@ Item {
|
||||
Logger.error("HyprlandService", "Failed to switch window:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function closeWindow(windowId) {
|
||||
try {
|
||||
Hyprland.dispatch(`killwindow ${windowId}`)
|
||||
|
||||
+10
-10
@@ -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()])
|
||||
|
||||
Reference in New Issue
Block a user