Fix ActiveWindow Title change (#128)
This commit is contained in:
parent
ca7e0cc105
commit
374d3681ce
2 changed files with 28 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ Row {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update text when window changes
|
// Update text when window changes or title changes
|
||||||
Connections {
|
Connections {
|
||||||
target: CompositorService
|
target: CompositorService
|
||||||
function onActiveWindowChanged() {
|
function onActiveWindowChanged() {
|
||||||
|
|
@ -38,11 +38,22 @@ Row {
|
||||||
fullTitleTimer.restart()
|
fullTitleTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onWindowTitleChanged() {
|
||||||
|
// Direct response to title changes
|
||||||
|
if (CompositorService.focusedWindowIndex === lastWindowIndex) {
|
||||||
|
// Same window, title changed - show full title briefly
|
||||||
|
showingFullTitle = true
|
||||||
|
fullTitleTimer.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTitle() {
|
function getTitle() {
|
||||||
const focusedWindow = CompositorService.getFocusedWindow()
|
// Use the service's focusedWindowTitle property which is updated immediately
|
||||||
return focusedWindow ? (focusedWindow.title || focusedWindow.appId || "") : ""
|
// when WindowOpenedOrChanged events are received
|
||||||
|
return CompositorService.focusedWindowTitle !== "(No active window)" ?
|
||||||
|
CompositorService.focusedWindowTitle : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAppIcon() {
|
function getAppIcon() {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ Singleton {
|
||||||
signal activeWindowChanged
|
signal activeWindowChanged
|
||||||
signal overviewStateChanged
|
signal overviewStateChanged
|
||||||
signal windowListChanged
|
signal windowListChanged
|
||||||
|
signal windowTitleChanged
|
||||||
|
|
||||||
// Compositor detection
|
// Compositor detection
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
@ -297,6 +298,8 @@ Singleton {
|
||||||
"isFocused": windowData.is_focused === true
|
"isFocused": windowData.is_focused === true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (existingIndex >= 0) {
|
if (existingIndex >= 0) {
|
||||||
// Update existing window
|
// Update existing window
|
||||||
windows[existingIndex] = newWindow
|
windows[existingIndex] = newWindow
|
||||||
|
|
@ -311,6 +314,11 @@ Singleton {
|
||||||
focusedWindowIndex = windows.findIndex(w => w.id === windowData.id)
|
focusedWindowIndex = windows.findIndex(w => w.id === windowData.id)
|
||||||
updateFocusedWindowTitle()
|
updateFocusedWindowTitle()
|
||||||
activeWindowChanged()
|
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()
|
windowListChanged()
|
||||||
|
|
@ -449,11 +457,17 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFocusedWindowTitle() {
|
function updateFocusedWindowTitle() {
|
||||||
|
const oldTitle = focusedWindowTitle
|
||||||
if (focusedWindowIndex >= 0 && focusedWindowIndex < windows.length) {
|
if (focusedWindowIndex >= 0 && focusedWindowIndex < windows.length) {
|
||||||
focusedWindowTitle = windows[focusedWindowIndex].title || "(Unnamed window)"
|
focusedWindowTitle = windows[focusedWindowIndex].title || "(Unnamed window)"
|
||||||
} else {
|
} else {
|
||||||
focusedWindowTitle = "(No active window)"
|
focusedWindowTitle = "(No active window)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emit signal if title actually changed
|
||||||
|
if (oldTitle !== focusedWindowTitle) {
|
||||||
|
windowTitleChanged()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic workspace switching
|
// Generic workspace switching
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue