diff --git a/Bar.qml b/Bar.qml index 063afbe..c57694b 100644 --- a/Bar.qml +++ b/Bar.qml @@ -25,6 +25,7 @@ Variants { color: "transparent" property var root: Quickshell.shellDir + WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.namespace: "ZShell-Bar" WlrLayershell.exclusionMode: ExclusionMode.Ignore @@ -33,6 +34,7 @@ Variants { WlrLayershell.namespace: "ZShell-Bar-Exclusion" screen: bar.screen WlrLayershell.layer: WlrLayer.Bottom + WlrLayershell.exclusionMode: Config.autoHide && !visibilities.bar ? ExclusionMode.Ignore : ExclusionMode.Auto anchors { left: true right: true @@ -50,8 +52,9 @@ Variants { } mask: Region { + id: region x: 0 - y: 34 + y: !visibilities.bar ? 4 : 34 property list nullRegions: [] property bool hcurrent: ( panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") ) || visibilities.sidebar || visibilities.dashboard @@ -92,6 +95,7 @@ Variants { property bool sidebar property bool dashboard + property bool bar Component.onCompleted: Visibilities.load(scope.modelData, this) } @@ -108,26 +112,32 @@ Variants { Border { bar: backgroundRect + visibilities: visibilities } Backgrounds { + visibilities: visibilities panels: panels bar: backgroundRect } } MouseArea { + id: mouseArea anchors.fill: parent hoverEnabled: true onContainsMouseChanged: { if ( !containsMouse ) { panels.popouts.hasCurrent = false; + if ( !visibilities.sidebar && !visibilities.dashboard ) + visibilities.bar = Config.autoHide ? false : true; } } onPositionChanged: event => { - if ( mouseY < backgroundRect.implicitHeight ) { + if ( !visibilities.bar ? mouseY < 4 : mouseY < backgroundRect.implicitHeight ) { + visibilities.bar = true; barLoader.checkPopout(mouseX); } } @@ -161,10 +171,11 @@ Variants { Rectangle { id: backgroundRect property Wrapper popouts: panels.popouts + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - anchors.top: parent.top implicitHeight: 34 + anchors.topMargin: Config.autoHide && !visibilities.bar ? -30 : 0 color: "transparent" radius: 0 @@ -172,6 +183,10 @@ Variants { CAnim {} } + Behavior on anchors.topMargin { + Anim {} + } + BarLoader { id: barLoader anchors.fill: parent diff --git a/Config/Config.qml b/Config/Config.qml index 2800040..53f87b1 100644 --- a/Config/Config.qml +++ b/Config/Config.qml @@ -32,6 +32,7 @@ Singleton { property alias general: adapter.general property alias dashboard: adapter.dashboard property alias appearance: adapter.appearance + property alias autoHide: adapter.autoHide FileView { id: root @@ -72,6 +73,7 @@ Singleton { property General general: General {} property DashboardConfig dashboard: DashboardConfig {} property AppearanceConf appearance: AppearanceConf {} + property bool autoHide: false } } } diff --git a/Drawers/Backgrounds.qml b/Drawers/Backgrounds.qml index d7c8c4f..058e275 100644 --- a/Drawers/Backgrounds.qml +++ b/Drawers/Backgrounds.qml @@ -1,3 +1,4 @@ +import Quickshell import QtQuick import QtQuick.Shapes import qs.Modules as Modules @@ -11,10 +12,11 @@ Shape { required property Panels panels required property Item bar + required property PersistentProperties visibilities anchors.fill: parent // anchors.margins: 8 - anchors.topMargin: bar.implicitHeight + anchors.topMargin: !root.visibilities.bar ? 4 : bar.implicitHeight preferredRendererType: Shape.CurveRenderer Modules.Background { diff --git a/Modules/Bar/BarLoader.qml b/Modules/Bar/BarLoader.qml index 3efa9af..4a30ea5 100644 --- a/Modules/Bar/BarLoader.qml +++ b/Modules/Bar/BarLoader.qml @@ -23,10 +23,11 @@ RowLayout { required property ShellScreen screen function checkPopout(x: real): void { - const ch = childAt(x, height / 2) as WrappedLoader; + const ch = childAt(x, 2) as WrappedLoader; - if (!ch && !popouts.currentName.includes("traymenu")) { - popouts.hasCurrent = false; + if (!ch) { + if ( !popouts.currentName.includes("traymenu") ) + popouts.hasCurrent = false; return; } diff --git a/Modules/Bar/Border.qml b/Modules/Bar/Border.qml index 0edfe55..dbb0324 100644 --- a/Modules/Bar/Border.qml +++ b/Modules/Bar/Border.qml @@ -1,5 +1,6 @@ pragma ComponentBehavior: Bound +import Quickshell import QtQuick import QtQuick.Effects import qs.Modules @@ -10,12 +11,13 @@ Item { id: root required property Item bar + required property PersistentProperties visibilities anchors.fill: parent CustomRect { anchors.fill: parent - color: DynamicColors.palette.m3surface + color: Config.autoHide && !root.visibilities.bar ? "transparent" : DynamicColors.palette.m3surface layer.enabled: true @@ -36,9 +38,12 @@ Item { Rectangle { anchors.fill: parent - anchors.topMargin: root.bar.implicitHeight + anchors.topMargin: Config.autoHide && !root.visibilities.bar ? 4 : root.bar.implicitHeight topLeftRadius: 8 topRightRadius: 8 + Behavior on anchors.topMargin { + Anim {} + } } } } diff --git a/Modules/UPower/UPowerWidget.qml b/Modules/UPower/UPowerWidget.qml index 59ab955..c4c11e0 100644 --- a/Modules/UPower/UPowerWidget.qml +++ b/Modules/UPower/UPowerWidget.qml @@ -16,8 +16,8 @@ Item { CustomRect { anchors.fill: parent - anchors.topMargin: 3 - anchors.bottomMargin: 3 + anchors.topMargin: 4 + anchors.bottomMargin: 4 color: DynamicColors.tPalette.m3surfaceContainer radius: 1000 }