Niri: optional "hideOnOverview" in bar settings

This commit is contained in:
Lemmy
2026-01-13 19:23:19 -05:00
parent f9d179f51c
commit cff663fee0
11 changed files with 64 additions and 8 deletions
+2
View File
@@ -691,6 +691,8 @@
"appearance-show-outline-label": "Show widget outlines",
"appearance-use-separate-opacity-description": "Enable to use a separate opacity value for the bar background.",
"appearance-use-separate-opacity-label": "Use separate bar opacity",
"appearance-hide-on-overview-description": "Hide the bar and close panels when the compositor overview is active.",
"appearance-hide-on-overview-label": "Hide bar on overview",
"monitors-desc": "Show bar on specific monitors. Defaults to all if none are chosen.",
"monitors-title": "Monitors display",
"title": "Bar",
+1
View File
@@ -14,6 +14,7 @@
"marginHorizontal": 4,
"outerCorners": true,
"exclusive": true,
"hideOnOverview": false,
"widgets": {
"left": [
{
+3
View File
@@ -209,6 +209,9 @@ Singleton {
// Reserves space with compositor
property bool exclusive: true
// Hide bar/panels when compositor overview is active
property bool hideOnOverview: false
// Widget configuration for modular bar system
property JsonObject widgets
widgets: JsonObject {
+3 -3
View File
@@ -56,7 +56,7 @@ Variants {
// Bar content in separate windows to prevent fullscreen redraws
Loader {
active: {
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.effectivelyVisible)
return false;
// Check if bar is configured for this screen
@@ -78,7 +78,7 @@ Variants {
// Disabled when bar is hidden or not configured for this screen
Loader {
active: {
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.effectivelyVisible)
return false;
// Check if bar is configured for this screen
@@ -100,7 +100,7 @@ Variants {
// Disabled when bar is hidden or not configured for this screen
Loader {
active: {
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.effectivelyVisible)
return false;
// Check if bar is configured for this screen
@@ -32,8 +32,8 @@ ShapePath {
// Check if bar should be visible on this screen
readonly property bool shouldShow: {
// Check global bar visibility
if (!BarService.isVisible)
// Check global bar visibility (includes overview state)
if (!BarService.effectivelyVisible)
return false;
// Check screen-specific configuration
+2 -2
View File
@@ -102,8 +102,8 @@ PanelWindow {
// Check if bar should be visible on this screen
readonly property bool barShouldShow: {
// Check global bar visibility
if (!BarService.isVisible)
// Check global bar visibility (includes overview state)
if (!BarService.effectivelyVisible)
return false;
// Check screen-specific configuration
+1 -1
View File
@@ -97,7 +97,7 @@ Item {
// Check if bar should be visible on this screen
readonly property bool barShouldShow: {
if (!BarService.isVisible)
if (!BarService.effectivelyVisible)
return false;
var monitors = Settings.data.bar.monitors || [];
var screenName = screen?.name || "";
@@ -2,6 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Services.Compositor
import qs.Widgets
ColumnLayout {
@@ -194,4 +195,14 @@ ColumnLayout {
}
}
}
NToggle {
Layout.fillWidth: true
visible: CompositorService.isNiri
label: I18n.tr("panels.bar.appearance-hide-on-overview-label")
description: I18n.tr("panels.bar.appearance-hide-on-overview-description")
checked: Settings.data.bar.hideOnOverview
defaultValue: Settings.getDefaultValue("bar.hideOnOverview")
onToggled: checked => Settings.data.bar.hideOnOverview = checked
}
}
+13
View File
@@ -26,6 +26,9 @@ Singleton {
property var displayScales: ({})
property bool displayScalesLoaded: false
// Overview state (Niri-specific, defaults to false for other compositors)
property bool overviewActive: false
// Generic events
signal workspaceChanged
signal activeWindowChanged
@@ -210,10 +213,20 @@ Singleton {
focusedWindowIndex = backend.focusedWindowIndex;
});
// Overview state (Niri-specific)
if (backend.overviewActiveChanged) {
backend.overviewActiveChanged.connect(() => {
overviewActive = backend.overviewActive;
});
}
// Initial sync
syncWorkspaces();
syncWindows();
focusedWindowIndex = backend.focusedWindowIndex;
if (backend.overviewActive !== undefined) {
overviewActive = backend.overviewActive;
}
}
function syncWorkspaces() {
+13
View File
@@ -3,11 +3,24 @@ pragma Singleton
import QtQuick
import Quickshell
import qs.Commons
import qs.Services.Compositor
Singleton {
id: root
property bool isVisible: true
// Computed visibility that factors in compositor overview state
readonly property bool effectivelyVisible: {
if (!isVisible) {
return false;
}
if (Settings.data.bar.hideOnOverview && CompositorService.overviewActive) {
return false;
}
return true;
}
property var readyBars: ({})
// Registry to store actual widget instances
+13
View File
@@ -3,6 +3,7 @@ pragma Singleton
import QtQuick
import Quickshell
import qs.Commons
import qs.Services.Compositor
Singleton {
id: root
@@ -142,4 +143,16 @@ Singleton {
// emit signal
didClose();
}
// Close panels when compositor overview opens (if setting is enabled)
Connections {
target: CompositorService
enabled: Settings.data.bar.hideOnOverview
function onOverviewActiveChanged() {
if (CompositorService.overviewActive && root.openedPanel) {
root.openedPanel.close();
}
}
}
}