Fix Hyprland active window
This commit is contained in:
parent
40d6595f5d
commit
b51e6a5e73
1 changed files with 50 additions and 0 deletions
|
|
@ -43,12 +43,23 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Hyprland.toplevels
|
||||
enabled: isHyprland
|
||||
function onValuesChanged() {
|
||||
updateHyprlandWindows()
|
||||
windowListChanged()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Hyprland
|
||||
enabled: isHyprland
|
||||
function onRawEvent(event) {
|
||||
updateHyprlandWorkspaces()
|
||||
workspaceChanged()
|
||||
updateHyprlandWindows()
|
||||
windowListChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +96,9 @@ Singleton {
|
|||
function initHyprland() {
|
||||
try {
|
||||
Hyprland.refreshWorkspaces()
|
||||
Hyprland.refreshToplevels()
|
||||
updateHyprlandWorkspaces()
|
||||
updateHyprlandWindows()
|
||||
setupHyprlandConnections()
|
||||
Logger.log("Compositor", "Hyprland initialized successfully")
|
||||
} catch (e) {
|
||||
|
|
@ -125,6 +138,43 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
function updateHyprlandWindows() {
|
||||
if (!isHyprland)
|
||||
return
|
||||
|
||||
try {
|
||||
const hlToplevels = Hyprland.toplevels.values
|
||||
const windowsList = []
|
||||
|
||||
for (var i = 0; i < hlToplevels.length; i++) {
|
||||
const toplevel = hlToplevels[i]
|
||||
windowsList.push({
|
||||
"id": toplevel.address || "",
|
||||
"title": toplevel.title || "",
|
||||
"appId": toplevel.class || toplevel.initialClass || "",
|
||||
"workspaceId": toplevel.workspace?.id || null,
|
||||
"isFocused": Hyprland.activeToplevel && Hyprland.activeToplevel.address === toplevel.address
|
||||
})
|
||||
}
|
||||
|
||||
windows = windowsList
|
||||
|
||||
// Update focused window index
|
||||
focusedWindowIndex = -1
|
||||
for (var j = 0; j < windowsList.length; j++) {
|
||||
if (windowsList[j].isFocused) {
|
||||
focusedWindowIndex = j
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
updateFocusedWindowTitle()
|
||||
activeWindowChanged()
|
||||
} catch (e) {
|
||||
Logger.error("Compositor", "Error updating Hyprland windows:", e)
|
||||
}
|
||||
}
|
||||
|
||||
// Niri integration
|
||||
function initNiri() {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue