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 {
|
Connections {
|
||||||
target: Hyprland
|
target: Hyprland
|
||||||
enabled: isHyprland
|
enabled: isHyprland
|
||||||
function onRawEvent(event) {
|
function onRawEvent(event) {
|
||||||
updateHyprlandWorkspaces()
|
updateHyprlandWorkspaces()
|
||||||
workspaceChanged()
|
workspaceChanged()
|
||||||
|
updateHyprlandWindows()
|
||||||
|
windowListChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +96,9 @@ Singleton {
|
||||||
function initHyprland() {
|
function initHyprland() {
|
||||||
try {
|
try {
|
||||||
Hyprland.refreshWorkspaces()
|
Hyprland.refreshWorkspaces()
|
||||||
|
Hyprland.refreshToplevels()
|
||||||
updateHyprlandWorkspaces()
|
updateHyprlandWorkspaces()
|
||||||
|
updateHyprlandWindows()
|
||||||
setupHyprlandConnections()
|
setupHyprlandConnections()
|
||||||
Logger.log("Compositor", "Hyprland initialized successfully")
|
Logger.log("Compositor", "Hyprland initialized successfully")
|
||||||
} catch (e) {
|
} 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
|
// Niri integration
|
||||||
function initNiri() {
|
function initNiri() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue