diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index f4f4fc71..c1d684f2 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -58,14 +58,10 @@ Variants { WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.session || panels.dashboard.needsKeyboard ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None - mask: Region { - x: bar.clampedWidth + win.dragMaskPadding - y: Config.border.clampedThickness + win.dragMaskPadding - width: win.width - bar.clampedWidth - Config.border.clampedThickness - win.dragMaskPadding * 2 - height: win.height - Config.border.clampedThickness * 2 - win.dragMaskPadding * 2 - intersection: Intersection.Xor - - regions: regions.instances // qmllint disable stale-property-read + mask: Regions { + bar: bar + panels: panels + win: win } anchors.top: true @@ -73,22 +69,6 @@ Variants { anchors.left: true anchors.right: true - Variants { - id: regions - - model: panels.children - - Region { - required property Item modelData - - x: modelData.x + bar.implicitWidth - y: modelData.y + Config.border.thickness - width: modelData.width - height: modelData.height - intersection: Intersection.Subtract - } - } - HyprlandFocusGrab { id: focusGrab diff --git a/modules/drawers/Regions.qml b/modules/drawers/Regions.qml new file mode 100644 index 00000000..c646809f --- /dev/null +++ b/modules/drawers/Regions.qml @@ -0,0 +1,80 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import Quickshell +import qs.config +import qs.modules.bar as Bar + +Region { + id: root + + required property Bar.BarWrapper bar + required property Panels panels + required property var win + + x: bar.clampedWidth + win.dragMaskPadding + y: Config.border.clampedThickness + win.dragMaskPadding + width: win.width - bar.clampedWidth - Config.border.clampedThickness - win.dragMaskPadding * 2 + height: win.height - Config.border.clampedThickness * 2 - win.dragMaskPadding * 2 + intersection: Intersection.Xor + + R { + panel: root.panels.dashboard + y: 0 + height: panel.height * (1 - root.panels.dashboard.offsetScale) + Config.border.thickness + } + + R { + panel: root.panels.launcher + y: root.win.height - height + height: panel.height * (1 - root.panels.launcher.offsetScale) + Config.border.thickness + } + + R { + id: sessionRegion + + panel: root.panels.sessionWrapper + x: root.win.width - width + width: panel.width * (1 - root.panels.session.offsetScale) + Config.border.thickness + sidebarRegion.width + } + + R { + id: sidebarRegion + + panel: root.panels.sidebar + x: root.win.width - width + width: panel.width * (1 - root.panels.sidebar.offsetScale) + Config.border.thickness + } + + R { + panel: root.panels.osdWrapper + x: root.win.width - width + width: panel.width * (1 - root.panels.osd.offsetScale) + Config.border.thickness + sessionRegion.width + } + + R { + panel: root.panels.notifications + y: 0 + height: panel.height + Config.border.thickness + } + + R { + panel: root.panels.utilities + y: root.win.height - height + height: panel.height * (1 - root.panels.utilities.offsetScale) + Config.border.thickness + } + + R { + panel: root.panels.popouts + } + + component R: Region { + required property Item panel + + x: panel.x + root.bar.implicitWidth + y: panel.y + Config.border.thickness + width: panel.width + height: panel.height + intersection: Intersection.Subtract + } +}