From 26bc5cd7c3bafcb649ad6b198ba404bb749aec63 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Mon, 9 Mar 2026 23:18:13 +0100 Subject: [PATCH] start of refactor --- Drawers/Interactions.qml | 6 +++--- Modules/Bar/Bar.qml | 23 +++++++++++------------ Modules/Dashboard/Wrapper.qml | 22 +++++++++++++--------- Modules/Osd/Wrapper.qml | 32 ++++++++++++++++++-------------- Modules/TrayItem.qml | 19 ------------------- Modules/TrayWidget.qml | 2 -- 6 files changed, 45 insertions(+), 59 deletions(-) diff --git a/Drawers/Interactions.qml b/Drawers/Interactions.qml index 79b0f72..fe03599 100644 --- a/Drawers/Interactions.qml +++ b/Drawers/Interactions.qml @@ -20,15 +20,15 @@ CustomMouseArea { required property PersistentProperties visibilities function inBottomPanel(panel: Item, x: real, y: real): bool { - return y > root.height - panel.height && withinPanelWidth(panel, x, y); + return y > root.height - panel.height - Config.barConfig.border && withinPanelWidth(panel, x, y); } function inLeftPanel(panel: Item, x: real, y: real): bool { - return x < panel.x + panel.width && withinPanelHeight(panel, x, y); + return x < panel.x + panel.width + Config.barConfig.border && withinPanelHeight(panel, x, y); } function inRightPanel(panel: Item, x: real, y: real): bool { - return x > panel.x && withinPanelHeight(panel, x, y); + return x > panel.x - Config.barConfig.border && withinPanelHeight(panel, x, y); } function inTopPanel(panel: Item, x: real, y: real): bool { diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index eb1dacd..3b58312 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -4,7 +4,7 @@ import Quickshell import QtQuick import QtQuick.Layouts import qs.Components -import qs.Modules +import qs.Modules as Bar import qs.Config import qs.Helpers import qs.Modules.UPower @@ -13,7 +13,7 @@ import qs.Modules.Network RowLayout { id: root - required property Wrapper popouts + required property Bar.Wrapper popouts required property ShellScreen screen readonly property int vPadding: 6 required property PersistentProperties visibilities @@ -73,7 +73,7 @@ RowLayout { roleValue: "workspaces" delegate: WrappedLoader { - sourceComponent: Workspaces { + sourceComponent: Bar.Workspaces { screen: root.screen } } @@ -83,7 +83,7 @@ RowLayout { roleValue: "audio" delegate: WrappedLoader { - sourceComponent: AudioWidget { + sourceComponent: Bar.AudioWidget { } } } @@ -92,8 +92,7 @@ RowLayout { roleValue: "tray" delegate: WrappedLoader { - sourceComponent: TrayWidget { - bar: root.bar + sourceComponent: Bar.TrayWidget { loader: root popouts: root.popouts } @@ -104,7 +103,7 @@ RowLayout { roleValue: "resources" delegate: WrappedLoader { - sourceComponent: Resources { + sourceComponent: Bar.Resources { visibilities: root.visibilities } } @@ -114,7 +113,7 @@ RowLayout { roleValue: "updates" delegate: WrappedLoader { - sourceComponent: UpdatesWidget { + sourceComponent: Bar.UpdatesWidget { } } } @@ -123,7 +122,7 @@ RowLayout { roleValue: "notifBell" delegate: WrappedLoader { - sourceComponent: NotifBell { + sourceComponent: Bar.NotifBell { popouts: root.popouts visibilities: root.visibilities } @@ -134,7 +133,7 @@ RowLayout { roleValue: "clock" delegate: WrappedLoader { - sourceComponent: Clock { + sourceComponent: Bar.Clock { loader: root popouts: root.popouts visibilities: root.visibilities @@ -146,7 +145,7 @@ RowLayout { roleValue: "activeWindow" delegate: WrappedLoader { - sourceComponent: WindowTitle { + sourceComponent: Bar.WindowTitle { bar: root } } @@ -174,7 +173,7 @@ RowLayout { roleValue: "media" delegate: WrappedLoader { - sourceComponent: MediaWidget { + sourceComponent: Bar.MediaWidget { } } } diff --git a/Modules/Dashboard/Wrapper.qml b/Modules/Dashboard/Wrapper.qml index 930b8a6..11858d6 100644 --- a/Modules/Dashboard/Wrapper.qml +++ b/Modules/Dashboard/Wrapper.qml @@ -72,17 +72,21 @@ Item { } } - Loader { - id: content + CustomClippingRect { + anchors.fill: parent - active: true - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - visible: false + Loader { + id: content - sourceComponent: Content { - state: root.dashState - visibilities: root.visibilities + active: true + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + visible: false + + sourceComponent: Content { + state: root.dashState + visibilities: root.visibilities + } } } } diff --git a/Modules/Osd/Wrapper.qml b/Modules/Osd/Wrapper.qml index 55f0311..b0815e8 100644 --- a/Modules/Osd/Wrapper.qml +++ b/Modules/Osd/Wrapper.qml @@ -113,22 +113,26 @@ Item { } } - Loader { - id: content + CustomClippingRect { + anchors.fill: parent - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter + Loader { + id: content - sourceComponent: Content { - brightness: root.brightness - monitor: root.monitor - muted: root.muted - sourceMuted: root.sourceMuted - sourceVolume: root.sourceVolume - visibilities: root.visibilities - volume: root.volume + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + sourceComponent: Content { + brightness: root.brightness + monitor: root.monitor + muted: root.muted + sourceMuted: root.sourceMuted + sourceVolume: root.sourceVolume + visibilities: root.visibilities + volume: root.volume + } + + Component.onCompleted: active = Qt.binding(() => root.shouldBeActive || root.visible) } - - Component.onCompleted: active = Qt.binding(() => root.shouldBeActive || root.visible) } } diff --git a/Modules/TrayItem.qml b/Modules/TrayItem.qml index c613677..9580969 100644 --- a/Modules/TrayItem.qml +++ b/Modules/TrayItem.qml @@ -9,7 +9,6 @@ import qs.Config Item { id: root - required property PanelWindow bar property bool hasLoaded: false required property int ind required property SystemTrayItem item @@ -46,22 +45,4 @@ Item { layer.enabled: DynamicColors.light source: root.item.icon } - - // Image { - // id: icon - // - // property bool batteryHDPI: root.bar.screen.x < 0 && root.item.icon.includes("battery") - // property bool nmHDPI: root.bar.screen.x < 0 && root.item.icon.includes("nm-") - // - // anchors.centerIn: parent - // width: batteryHDPI ? 26 : ( nmHDPI ? 25 : 22 ) - // height: batteryHDPI ? 26 : ( nmHDPI ? 25 : 22 ) - // source: root.item.icon - // mipmap: true - // smooth: ( batteryHDPI || nmHDPI ) ? false : true - // asynchronous: true - // sourceSize.width: ( batteryHDPI || nmHDPI ) ? 16 : 22 - // sourceSize.height: ( batteryHDPI || nmHDPI ) ? 16 : 22 - // fillMode: Image.PreserveAspectFit - // } } diff --git a/Modules/TrayWidget.qml b/Modules/TrayWidget.qml index 07e2e02..fd55ed8 100644 --- a/Modules/TrayWidget.qml +++ b/Modules/TrayWidget.qml @@ -10,7 +10,6 @@ import qs.Config Item { id: root - required property PanelWindow bar readonly property alias items: repeater required property RowLayout loader required property Wrapper popouts @@ -45,7 +44,6 @@ Item { required property int index required property SystemTrayItem modelData - bar: root.bar implicitHeight: 34 implicitWidth: 34 ind: index