From c1d7bcb2b686be8ed1d9fd92c255603112eb9c56 Mon Sep 17 00:00:00 2001
From: matt1432 <matt@nelim.org>
Date: Sun, 27 Apr 2025 18:11:50 -0400
Subject: [PATCH] feat(quickshell): separate Bar from shell.qml

---
 .../Components/RoundCorner/RoundCorner.qml    | 11 +---
 modules/quickshell/config/Widgets/Bar/Bar.qml | 66 +++++++++++++++++++
 .../Widgets/ScreenCorners/ScreenCorners.qml   | 17 ++++-
 modules/quickshell/config/shell.qml           | 23 +------
 4 files changed, 84 insertions(+), 33 deletions(-)
 create mode 100644 modules/quickshell/config/Widgets/Bar/Bar.qml

diff --git a/modules/quickshell/config/Components/RoundCorner/RoundCorner.qml b/modules/quickshell/config/Components/RoundCorner/RoundCorner.qml
index f9dcd046..ac0f7c0b 100644
--- a/modules/quickshell/config/Components/RoundCorner/RoundCorner.qml
+++ b/modules/quickshell/config/Components/RoundCorner/RoundCorner.qml
@@ -1,7 +1,5 @@
 import QtQuick
 
-import "../../Config/Theme"
-
 Item {
     id: root
 
@@ -12,8 +10,8 @@ Item {
         BottomRight
     }
 
-    property color color: theme.windowBg
-    property int corner: RoundCorner.Corner.TopLeft // Default to TopLeft
+    property color color: "black"
+    property int corner: RoundCorner.Corner.TopLeft
 
     property int size: 15
 
@@ -24,11 +22,6 @@ Item {
         canvas.requestPaint();
     }
 
-    Theme {
-        id: theme
-
-    }
-
     Canvas {
         id: canvas
 
diff --git a/modules/quickshell/config/Widgets/Bar/Bar.qml b/modules/quickshell/config/Widgets/Bar/Bar.qml
new file mode 100644
index 00000000..9ba2ac32
--- /dev/null
+++ b/modules/quickshell/config/Widgets/Bar/Bar.qml
@@ -0,0 +1,66 @@
+import Quickshell
+import QtQuick
+import QtQuick.Layouts
+
+import "../../Components/RoundCorner"
+import "../../Config/Theme"
+
+PanelWindow {
+    id: toplevel
+
+    color: "transparent"
+    exclusiveZone: bar.height
+
+    Theme {
+        id: theme
+
+    }
+
+    anchors {
+        left: true
+        right: true
+        top: true
+    }
+
+    Rectangle {
+        id: bar
+
+        color: theme.windowBg
+        height: 30
+
+        anchors {
+            left: parent.left
+            right: parent.right
+        }
+
+        Text {
+            anchors.centerIn: parent
+            color: theme.windowFg
+            text: "hello world"
+        }
+    }
+
+    RowLayout {
+        spacing: bar.width - leftCorner.width - rightCorner.width
+
+        anchors {
+            left: parent.left
+            right: parent.right
+            top: bar.bottom
+        }
+
+        RoundCorner {
+            id: leftCorner
+
+            color: theme.windowBg
+            corner: RoundCorner.Corner.TopLeft
+        }
+
+        RoundCorner {
+            id: rightCorner
+
+            color: theme.windowBg
+            corner: RoundCorner.Corner.TopRight
+        }
+    }
+}
diff --git a/modules/quickshell/config/Widgets/ScreenCorners/ScreenCorners.qml b/modules/quickshell/config/Widgets/ScreenCorners/ScreenCorners.qml
index f68c2ed6..ab5f0934 100644
--- a/modules/quickshell/config/Widgets/ScreenCorners/ScreenCorners.qml
+++ b/modules/quickshell/config/Widgets/ScreenCorners/ScreenCorners.qml
@@ -19,18 +19,29 @@ Scope {
             WlrLayershell.layer: WlrLayer.Overlay
             WlrLayershell.namespace: "quickshell:screenCorners"
             color: "transparent"
-            exclusionMode: ExclusionMode.Normal
-            margins.bottom: -1
+            exclusionMode: ExclusionMode.Ignore
             screen: modelData
 
             mask: Region {
-                item: null
             }
 
             anchors {
                 bottom: true
                 left: true
                 right: true
+                top: true
+            }
+
+            RoundCorner {
+                anchors.left: parent.left
+                anchors.top: parent.top
+                corner: RoundCorner.Corner.TopLeft
+            }
+
+            RoundCorner {
+                anchors.right: parent.right
+                anchors.top: parent.top
+                corner: RoundCorner.Corner.TopRight
             }
 
             RoundCorner {
diff --git a/modules/quickshell/config/shell.qml b/modules/quickshell/config/shell.qml
index 270c920f..d427071b 100644
--- a/modules/quickshell/config/shell.qml
+++ b/modules/quickshell/config/shell.qml
@@ -1,32 +1,13 @@
 import Quickshell
 import QtQuick
 
+import "./Widgets/Bar"
 import "./Widgets/ScreenCorners"
-import "./Config/Theme"
 
 ShellRoot {
-    Theme {
-        id: theme
-
+    Bar {
     }
 
     ScreenCorners {
     }
-
-    PanelWindow {
-        color: theme.windowBg
-        height: 30
-
-        anchors {
-            bottom: true
-            left: true
-            right: true
-        }
-
-        Text {
-            anchors.centerIn: parent
-            color: theme.windowFg
-            text: "hello world"
-        }
-    }
 }