mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 00:42:50 -05:00
Fix focused app taking up space when no focused window
+ Fix niri retaining focused windows from last workspace
This commit is contained in:
@@ -16,8 +16,29 @@ Rectangle {
|
|||||||
readonly property int maxNormalWidth: 456
|
readonly property int maxNormalWidth: 456
|
||||||
readonly property int maxCompactWidth: 288
|
readonly property int maxCompactWidth: 288
|
||||||
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
|
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
|
||||||
|
readonly property bool hasWindowsOnCurrentWorkspace: {
|
||||||
|
if (!CompositorService.isNiri) {
|
||||||
|
return activeWindow && activeWindow.title
|
||||||
|
}
|
||||||
|
|
||||||
width: compactMode ? Math.min(baseWidth, maxCompactWidth) : Math.min(baseWidth, maxNormalWidth)
|
let currentWorkspaceId = null
|
||||||
|
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
|
||||||
|
const ws = NiriService.allWorkspaces[i]
|
||||||
|
if (ws.is_focused) {
|
||||||
|
currentWorkspaceId = ws.id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentWorkspaceId) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspaceWindows = NiriService.windows.filter(w => w.workspace_id === currentWorkspaceId)
|
||||||
|
return workspaceWindows.length > 0 && activeWindow && activeWindow.title
|
||||||
|
}
|
||||||
|
|
||||||
|
width: !hasWindowsOnCurrentWorkspace ? 0 : (compactMode ? Math.min(baseWidth, maxCompactWidth) : Math.min(baseWidth, maxNormalWidth))
|
||||||
height: widgetHeight
|
height: widgetHeight
|
||||||
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
@@ -33,7 +54,7 @@ Rectangle {
|
|||||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
visible: activeWindow && activeWindow.title
|
visible: hasWindowsOnCurrentWorkspace
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: contentRow
|
id: contentRow
|
||||||
|
|||||||
Reference in New Issue
Block a user