From 56b5b0a4e695910836bf8be2923bdf63c6e088de Mon Sep 17 00:00:00 2001 From: lucy Date: Thu, 16 Jul 2026 09:39:55 +0200 Subject: [PATCH] add left and right spacing --- modules/bar/Bar.qml | 136 ++++++++++++++++++++++---------------------- modules/bar/Ws.qml | 81 +++++++++++++------------- 2 files changed, 109 insertions(+), 108 deletions(-) diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index bb45748..97aa11a 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -7,73 +7,73 @@ import qs import qs.settings Variants { - model: Quickshell.screens - delegate: WlrLayershell { - id: root - required property var modelData - property double moduleHeight: implicitHeight - 12 - screen: modelData - anchors { - top: true - left: true - right: true - } - margins { - top: Config.floating ? 10 : 0 - left: Config.floating ? 10 : 0 - right: Config.floating ? 10 : 0 - } - color: 'transparent' - implicitHeight: Config.barHeight - layer: WlrLayer.Top - Rectangle { - radius: Config.floating ? Config.rounding : 0 - color: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity) - id: container - anchors.fill: parent - RowLayout { - id: leftLayout - spacing: 5 - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: Config.rounding - Ws { - moduleHeight: root.moduleHeight - barScreen: root.modelData - } - ActiveWindow { - moduleHeight: root.moduleHeight - } - } - - RowLayout { - id: centerLayout - anchors.centerIn: parent - spacing: 5 - Clock { - moduleHeight: root.moduleHeight - } - } - - RowLayout { - id: rightLayout - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: 5 - anchors.rightMargin: Config.rounding - Mpris { - moduleHeight: root.moduleHeight - } - Bat { - moduleHeight: root.moduleHeight - } - Pw { - moduleHeight: root.moduleHeight - } - Tray { - moduleHeight: root.moduleHeight - } - } - } + model: Quickshell.screens + delegate: WlrLayershell { + id: root + required property var modelData + property double moduleHeight: implicitHeight - 12 + screen: modelData + anchors { + top: true + left: true + right: true } + margins { + top: Config.floating ? 10 : 0 + left: Config.floating ? 10 : 0 + right: Config.floating ? 10 : 0 + } + color: 'transparent' + implicitHeight: Config.barHeight + layer: WlrLayer.Top + Rectangle { + id: container + radius: Config.floating ? Config.rounding : 0 + color: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity) + anchors.fill: parent + RowLayout { + id: leftLayout + spacing: 5 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: Config.rounding == 0 ? 10 : Config.rounding + Ws { + moduleHeight: root.moduleHeight + barScreen: root.modelData + } + ActiveWindow { + moduleHeight: root.moduleHeight + } + } + + RowLayout { + id: centerLayout + anchors.centerIn: parent + spacing: 5 + Clock { + moduleHeight: root.moduleHeight + } + } + + RowLayout { + id: rightLayout + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: 5 + anchors.rightMargin: Config.rounding == 0 ? 10 : Config.rounding + Mpris { + moduleHeight: root.moduleHeight + } + Bat { + moduleHeight: root.moduleHeight + } + Pw { + moduleHeight: root.moduleHeight + } + Tray { + moduleHeight: root.moduleHeight + } + } + } + } } diff --git a/modules/bar/Ws.qml b/modules/bar/Ws.qml index 6042f56..87226d8 100644 --- a/modules/bar/Ws.qml +++ b/modules/bar/Ws.qml @@ -9,49 +9,50 @@ import qs.widgets import qs.settings Rectangle { - id: root - required property ShellScreen barScreen - required property double moduleHeight - radius: Config.rounding - color: 'transparent' - implicitWidth: wsLayout.implicitWidth - implicitHeight: moduleHeight + id: root + required property ShellScreen barScreen + required property double moduleHeight + radius: Config.rounding + color: 'transparent' + implicitWidth: wsLayout.implicitWidth + implicitHeight: moduleHeight - RowLayout { - id: wsLayout - anchors.centerIn: root - anchors.horizontalCenter: parent.horizontalCenter - spacing: 0 - Repeater { - id: wsRepeater - model: Hyprland.workspaces - delegate: Rectangle { - id: wsWrapper - required property var modelData - property bool active: modelData.active - property bool vacant: modelData.toplevels.values.length === 0 - visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor + RowLayout { + id: wsLayout + anchors.centerIn: root + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Repeater { + id: wsRepeater + model: Hyprland.workspaces + delegate: Rectangle { + id: wsWrapper + required property var modelData + property bool active: modelData.active + property bool vacant: modelData.toplevels.values.length === 0 + visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor - implicitHeight: root.moduleHeight - implicitWidth: 16 - parent: wsLayout - color: 'transparent' - radius: Config.rounding + implicitHeight: root.moduleHeight + implicitWidth: 16 + parent: wsLayout + color: 'transparent' + radius: Config.rounding - StyledText { - anchors.centerIn: parent - text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id - color: wsWrapper.active ? Colors.base0D : Colors.base04 - font.bold: wsWrapper.active - } - MouseArea { - id: clickHandler - anchors.fill: parent - acceptedButtons: Qt.LeftButton - cursorShape: Qt.PointingHandCursor - onClicked: wsWrapper.ws.activate() - } - } + StyledText { + anchors.centerIn: parent + text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id + color: wsWrapper.active ? Colors.base0D : Colors.base04 + opacity: wsWrapper.active ? 1.0 : 0.4 + font.bold: wsWrapper.active } + MouseArea { + id: clickHandler + anchors.fill: parent + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + onClicked: wsWrapper.ws.activate() + } + } } + } }