From 47b6b365a1bbb131ad0c97c92f2bd748541999f3 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 8 Sep 2025 19:52:27 -0400 Subject: [PATCH] make show on overview top bar independent --- Common/SettingsData.qml | 4 +- Modules/Settings/TopBarTab.qml | 122 ++++++++++++++++----------------- Modules/TopBar/TopBar.qml | 14 +++- 3 files changed, 74 insertions(+), 66 deletions(-) diff --git a/Common/SettingsData.qml b/Common/SettingsData.qml index b9b6e576..59b69e9b 100644 --- a/Common/SettingsData.qml +++ b/Common/SettingsData.qml @@ -89,7 +89,7 @@ Singleton { property real cornerRadius: 12 property bool notificationOverlayEnabled: false property bool topBarAutoHide: false - property bool topBarOpenOnOverview: false + property bool topBarOpenOnOverview: true property bool topBarVisible: true property real topBarSpacing: 4 property real topBarBottomGap: 0 @@ -253,7 +253,7 @@ Singleton { cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12 notificationOverlayEnabled = settings.notificationOverlayEnabled !== undefined ? settings.notificationOverlayEnabled : false topBarAutoHide = settings.topBarAutoHide !== undefined ? settings.topBarAutoHide : false - topBarOpenOnOverview = settings.topBarOpenOnOverview !== undefined ? settings.topBarOpenOnOverview : false + topBarOpenOnOverview = settings.topBarOpenOnOverview !== undefined ? settings.topBarOpenOnOverview : true topBarVisible = settings.topBarVisible !== undefined ? settings.topBarVisible : true notificationTimeoutLow = settings.notificationTimeoutLow !== undefined ? settings.notificationTimeoutLow : 5000 notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000 diff --git a/Modules/Settings/TopBarTab.qml b/Modules/Settings/TopBarTab.qml index fe161e04..8921d494 100644 --- a/Modules/Settings/TopBarTab.qml +++ b/Modules/Settings/TopBarTab.qml @@ -578,71 +578,12 @@ Item { } } - Row { + Rectangle { width: parent.width - spacing: Theme.spacingM - visible: SettingsData.topBarAutoHide && CompositorService.isNiri - - DankIcon { - name: "fullscreen" - size: Theme.iconSize - color: Theme.primary - anchors.verticalCenter: parent.verticalCenter - } - - Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - overviewToggle.width - Theme.spacingM - spacing: Theme.spacingXS - anchors.verticalCenter: parent.verticalCenter - - StyledText { - text: "Open on Overview" - font.pixelSize: Theme.fontSizeLarge - font.weight: Font.Medium - color: Theme.surfaceText - } - - StyledText { - text: "Always show the top bar when niri's overview is open" - font.pixelSize: Theme.fontSizeSmall - color: Theme.surfaceVariantText - wrapMode: Text.WordWrap - width: parent.width - } - } - - DankToggle { - id: overviewToggle - - anchors.verticalCenter: parent.verticalCenter - checked: SettingsData.topBarOpenOnOverview - onToggled: toggled => { - return SettingsData.setTopBarOpenOnOverview( - toggled) - } - } + height: 1 + color: Theme.outline + opacity: 0.2 } - } - } - - // Manual Visibility Toggle - StyledRect { - width: parent.width - height: topBarVisibilitySection.implicitHeight + Theme.spacingL * 2 - radius: Theme.cornerRadius - color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, - Theme.surfaceVariant.b, 0.3) - border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, - Theme.outline.b, 0.2) - border.width: 1 - - Column { - id: topBarVisibilitySection - - anchors.fill: parent - anchors.margins: Theme.spacingL - spacing: Theme.spacingM Row { width: parent.width @@ -688,9 +629,64 @@ Item { } } } + + Rectangle { + width: parent.width + height: 1 + color: Theme.outline + opacity: 0.2 + visible: CompositorService.isNiri + } + + Row { + width: parent.width + spacing: Theme.spacingM + visible: CompositorService.isNiri + + DankIcon { + name: "fullscreen" + size: Theme.iconSize + color: Theme.primary + anchors.verticalCenter: parent.verticalCenter + } + + Column { + width: parent.width - Theme.iconSize - Theme.spacingM + - overviewToggle.width - Theme.spacingM + spacing: Theme.spacingXS + anchors.verticalCenter: parent.verticalCenter + + StyledText { + text: "Show on Overview" + font.pixelSize: Theme.fontSizeLarge + font.weight: Font.Medium + color: Theme.surfaceText + } + + StyledText { + text: "Always show the top bar when niri's overview is open" + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + wrapMode: Text.WordWrap + width: parent.width + } + } + + DankToggle { + id: overviewToggle + + anchors.verticalCenter: parent.verticalCenter + checked: SettingsData.topBarOpenOnOverview + onToggled: toggled => { + return SettingsData.setTopBarOpenOnOverview( + toggled) + } + } + } } } + // Spacing StyledRect { width: parent.width diff --git a/Modules/TopBar/TopBar.qml b/Modules/TopBar/TopBar.qml index dd3acd56..d12354f1 100644 --- a/Modules/TopBar/TopBar.qml +++ b/Modules/TopBar/TopBar.qml @@ -139,7 +139,19 @@ PanelWindow { property real backgroundTransparency: SettingsData.topBarTransparency property bool autoHide: SettingsData.topBarAutoHide - property bool reveal: SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout || (SettingsData.topBarOpenOnOverview && CompositorService.isNiri && NiriService.inOverview)) + property bool reveal: { + // Handle Niri overview state first + if (CompositorService.isNiri && NiriService.inOverview) { + // If Show on Overview is enabled, show the bar + if (SettingsData.topBarOpenOnOverview) { + return true + } + // If Show on Overview is disabled, hide the bar + return false + } + // Normal visibility logic when not in overview + return SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout) + } property var notepadInstance: null property bool notepadInstanceVisible: notepadInstance?.notepadVisible ?? false