Fix ActiveWindow Title change (#128)
This commit is contained in:
parent
ca7e0cc105
commit
374d3681ce
2 changed files with 28 additions and 3 deletions
|
|
@ -27,6 +27,7 @@ Singleton {
|
|||
signal activeWindowChanged
|
||||
signal overviewStateChanged
|
||||
signal windowListChanged
|
||||
signal windowTitleChanged
|
||||
|
||||
// Compositor detection
|
||||
Component.onCompleted: {
|
||||
|
|
@ -297,6 +298,8 @@ Singleton {
|
|||
"isFocused": windowData.is_focused === true
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
// Update existing window
|
||||
windows[existingIndex] = newWindow
|
||||
|
|
@ -311,6 +314,11 @@ Singleton {
|
|||
focusedWindowIndex = windows.findIndex(w => w.id === windowData.id)
|
||||
updateFocusedWindowTitle()
|
||||
activeWindowChanged()
|
||||
} else if (existingIndex >= 0 && existingIndex === focusedWindowIndex) {
|
||||
// If this is the currently focused window (but not newly focused),
|
||||
// still update the title in case it changed
|
||||
updateFocusedWindowTitle()
|
||||
activeWindowChanged()
|
||||
}
|
||||
|
||||
windowListChanged()
|
||||
|
|
@ -449,11 +457,17 @@ Singleton {
|
|||
}
|
||||
|
||||
function updateFocusedWindowTitle() {
|
||||
const oldTitle = focusedWindowTitle
|
||||
if (focusedWindowIndex >= 0 && focusedWindowIndex < windows.length) {
|
||||
focusedWindowTitle = windows[focusedWindowIndex].title || "(Unnamed window)"
|
||||
} else {
|
||||
focusedWindowTitle = "(No active window)"
|
||||
}
|
||||
|
||||
// Emit signal if title actually changed
|
||||
if (oldTitle !== focusedWindowTitle) {
|
||||
windowTitleChanged()
|
||||
}
|
||||
}
|
||||
|
||||
// Generic workspace switching
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue