mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-09 15:05:39 -05:00
fix some topbar issues
This commit is contained in:
@@ -29,7 +29,7 @@ Singleton {
|
||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,29 @@ Singleton {
|
||||
root.focusedAppId = ""
|
||||
root.focusedAppName = ""
|
||||
root.focusedWindowTitle = ""
|
||||
root.focusedWindowId = -1
|
||||
}
|
||||
|
||||
function setWorkspaceFallback() {
|
||||
if (NiriService.focusedWorkspaceIndex >= 0 && NiriService.allWorkspaces.length > 0) {
|
||||
const workspace = NiriService.allWorkspaces[NiriService.focusedWorkspaceIndex]
|
||||
if (workspace) {
|
||||
root.focusedAppId = "niri"
|
||||
root.focusedAppName = "niri"
|
||||
if (workspace.name && workspace.name.length > 0) {
|
||||
root.focusedWindowTitle = workspace.name
|
||||
} else {
|
||||
root.focusedWindowTitle = "Workspace " + (workspace.idx + 1)
|
||||
}
|
||||
root.focusedWindowId = -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
}
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
}
|
||||
}
|
||||
|
||||
// Convert app_id to a more user-friendly display name
|
||||
function getDisplayName(appId) {
|
||||
if (!appId)
|
||||
return ""
|
||||
@@ -62,7 +82,7 @@ Singleton {
|
||||
function onFocusedWindowIdChanged() {
|
||||
const focusedWindowId = NiriService.focusedWindowId
|
||||
if (!focusedWindowId) {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -74,7 +94,7 @@ Singleton {
|
||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user