redo bar right and left padding logic

This commit is contained in:
lucy 2026-07-17 23:43:54 +02:00
commit f30fbb36ca
2 changed files with 9 additions and 8 deletions

View file

@ -11,7 +11,7 @@ Variants {
delegate: WlrLayershell { delegate: WlrLayershell {
id: root id: root
required property var modelData required property var modelData
property double moduleHeight: implicitHeight - 12 property double moduleHeight: implicitHeight - 10
screen: modelData screen: modelData
anchors { anchors {
top: true top: true
@ -36,7 +36,7 @@ Variants {
spacing: 5 spacing: 5
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Config.rounding == 0 ? Config.floating ? 0 : 10 : Config.barHeight / 4 anchors.leftMargin: Config.rounding == 0 ? Config.floating ? 0 : 10 : root.moduleHeight / 4
Ws { Ws {
moduleHeight: root.moduleHeight moduleHeight: root.moduleHeight
barScreen: root.modelData barScreen: root.modelData
@ -60,7 +60,7 @@ Variants {
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: 5 spacing: 5
anchors.rightMargin: Config.rounding == 0 ? Config.floating ? 0 : 10 : Config.barHeight / 4 anchors.rightMargin: Config.rounding == 0 ? Config.floating ? 0 : 10 : root.moduleHeight / 4
Mpris { Mpris {
moduleHeight: root.moduleHeight moduleHeight: root.moduleHeight
} }

View file

@ -14,14 +14,14 @@ Rectangle {
required property double moduleHeight required property double moduleHeight
radius: Config.rounding radius: Config.rounding
color: 'transparent' color: 'transparent'
implicitWidth: wsLayout.implicitWidth implicitWidth: wsLayout.implicitWidth + 10
implicitHeight: moduleHeight implicitHeight: moduleHeight
RowLayout { RowLayout {
id: wsLayout id: wsLayout
anchors.centerIn: root anchors.centerIn: root
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: 0 spacing: 10
Repeater { Repeater {
id: wsRepeater id: wsRepeater
model: Hyprland.workspaces model: Hyprland.workspaces
@ -33,14 +33,15 @@ Rectangle {
visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor
implicitHeight: root.moduleHeight implicitHeight: root.moduleHeight
implicitWidth: 16 implicitWidth: wsName.width
parent: wsLayout parent: wsLayout
color: 'transparent' color: 'transparent'
radius: Config.rounding radius: Config.rounding
StyledText { StyledText {
id: wsName
anchors.centerIn: parent anchors.centerIn: parent
text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id text: wsWrapper.modelData.name
color: wsWrapper.active ? Colors.base0D : Colors.base04 color: wsWrapper.active ? Colors.base0D : Colors.base04
opacity: wsWrapper.active ? 1.0 : 0.4 opacity: wsWrapper.active ? 1.0 : 0.4
font.bold: wsWrapper.active font.bold: wsWrapper.active
@ -50,7 +51,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: wsWrapper.ws.activate() onClicked: wsWrapper.modelData.activate()
} }
} }
} }