summaryrefslogtreecommitdiff
path: root/bar/Bar.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-18 17:31:11 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-18 17:31:11 +0800
commit19caef7270457ce8986993e9ba78dcb417b7190a (patch)
tree9276758de147c2fd7eb5e9cfffbf877f1448550f /bar/Bar.qml
parent3e5ba8e77262aaf22a5ff42546b3e8a057b6dfcb (diff)
shell: handle multi screen at root scope
remember to keep duplicated reactions in mind
Diffstat (limited to 'bar/Bar.qml')
-rw-r--r--bar/Bar.qml201
1 files changed, 100 insertions, 101 deletions
diff --git a/bar/Bar.qml b/bar/Bar.qml
index 4dac781..c934a22 100644
--- a/bar/Bar.qml
+++ b/bar/Bar.qml
@@ -6,127 +6,126 @@ import qs.config
Scope {
id: root
+ required property ShellScreen modelData
- Variants {
- model: Quickshell.screens
+ IWindow {
+ id: barWindow
- IWindow {
- id: barWindow
- name: "quickshell:bar"
+ modelData: root.modelData
+ name: "quickshell:bar"
+
+ anchors {
+ top: true
+ left: true
+ right: true
+ }
+ implicitHeight: child.implicitHeight + Bar.topMargin * 2
+
+ Rectangle {
+ id: child
+ radius: Bar.borderRadius
+ implicitHeight: Bar.height
+ implicitWidth: parent.width
anchors {
- top: true
- left: true
- right: true
+ left: parent.left
+ right: parent.mid
+ fill: parent
+ top: parent.top
+ topMargin: Bar.topMargin
+ leftMargin: Bar.leftMargin
+ rightMargin: Bar.rightMargin
}
- implicitHeight: child.implicitHeight + Bar.topMargin * 2
+
+ color: "transparent"
Rectangle {
- id: child
- radius: Bar.borderRadius
- implicitHeight: Bar.height
- implicitWidth: parent.width
+ anchors.left: parent.left
+ width: leftRow.width + leftRow.anchors.leftMargin - leftSpacer.width
+ height: leftRow.height
+ color: Qt.rgba(WallustColors.background.r, WallustColors.background.g, WallustColors.background.b, Bar.bgTransparency)
+ radius: Bar.moduleRadius
+ }
+ RowLayout {
+ id: leftRow
anchors {
left: parent.left
- right: parent.mid
- fill: parent
- top: parent.top
- topMargin: Bar.topMargin
- leftMargin: Bar.leftMargin
- rightMargin: Bar.rightMargin
+ leftMargin: Bar.moduleLeftMargin
}
-
- color: "transparent"
-
- Rectangle {
- anchors.left: parent.left
- width: leftRow.width + leftRow.anchors.leftMargin - leftSpacer.width
- height: leftRow.height
- color: Qt.rgba(WallustColors.background.r, WallustColors.background.g, WallustColors.background.b, Bar.bgTransparency)
- radius: Bar.moduleRadius
+ width: (child.width - centerRow.width) / 2
+ height: child.height
+ spacing: Bar.leftModuleSpacing
+
+ Workspace {
+ id: workspace
+ // screen: barWindow.screen // multi monitor
+ // Layout.minimumWidth: 400 // FIXME
+ }
+ Mpris {
+ id: mpris
+ }
+ Item {
+ id: leftSpacer
+ Layout.fillWidth: true
+ Layout.fillHeight: true
}
+ }
+
+ Item {
+ id: centerRow
+ anchors.centerIn: parent
- RowLayout {
- id: leftRow
- anchors {
- left: parent.left
- leftMargin: Bar.moduleLeftMargin
- }
- width: (child.width - centerRow.width) / 2
- height: child.height
- spacing: Bar.leftModuleSpacing
-
- Workspace {
- id: workspace
- // screen: barWindow.screen // multi monitor
- // Layout.minimumWidth: 400 // FIXME
- }
- Mpris {
- id: mpris
- }
- Item {
- id: leftSpacer
- Layout.fillWidth: true
- Layout.fillHeight: true
- }
+ ActiveWindow {
+ id: activeWindow
}
+ }
- Item {
- id: centerRow
- anchors.centerIn: parent
+ Rectangle {
+ anchors.right: parent.right
+ width: rightRow.width + rightRow.anchors.rightMargin - rightSpacer.width
+ height: rightRow.height
+ color: Qt.rgba(WallustColors.background.r, WallustColors.background.g, WallustColors.background.b, Bar.bgTransparency)
+ radius: Bar.moduleRadius
+ }
- ActiveWindow {
- id: activeWindow
- }
+ RowLayout {
+ id: rightRow
+ anchors {
+ right: parent.right
+ rightMargin: Bar.moduleRightMargin
}
+ layoutDirection: Qt.RightToLeft
+ width: (child.width - centerRow.width) / 2
+ height: child.height
+ spacing: Bar.rightModuleSpacing
- Rectangle {
- anchors.right: parent.right
- width: rightRow.width + rightRow.anchors.rightMargin - rightSpacer.width
- height: rightRow.height
- color: Qt.rgba(WallustColors.background.r, WallustColors.background.g, WallustColors.background.b, Bar.bgTransparency)
- radius: Bar.moduleRadius
+ Power {
+ id: power
}
+ // Tray {
+ // id: tray
+ // }
+ TimeDate {}
+ Network {}
+ // Temp {
+ // id: temp
+ // }
+ // Gpu {
+ // id: gpu
+ // }
+ // Memory {
+ // id: memory
+ // }
+ // Cpu {
+ // id: cpu
+ // }
+ Resources {}
- RowLayout {
- id: rightRow
- anchors {
- right: parent.right
- rightMargin: Bar.moduleRightMargin
- }
- layoutDirection: Qt.RightToLeft
- width: (child.width - centerRow.width) / 2
- height: child.height
- spacing: Bar.rightModuleSpacing
-
- Power {
- id: power
- }
- // Tray {
- // id: tray
- // }
- TimeDate {}
- Network {}
- // Temp {
- // id: temp
- // }
- // Gpu {
- // id: gpu
- // }
- // Memory {
- // id: memory
- // }
- // Cpu {
- // id: cpu
- // }
- Resources {}
-
- Item {
- id: rightSpacer
- Layout.fillWidth: true
- Layout.fillHeight: true
- }
+ Item {
+ id: rightSpacer
+ Layout.fillWidth: true
+ Layout.fillHeight: true
}
}
}