feat: refactor bar spacing functions to use dedicated functions

This commit is contained in:
Hannes
2026-09-01 13:52:03 +02:00
parent 36486179d5
commit 764f8197fb
13 changed files with 47 additions and 36 deletions
+9 -9
View File
@@ -8,8 +8,8 @@ Rectangle {
id: workspacesContainer
required property HyprlandMonitor thisMonitor
height: bar.height - (Config.spacing_fun(bar.height) * 1.5)
width: workspacesRow.width + (Config.spacing_fun(bar.height) * 2)
height: bar.height - (Config.bar_spacing_fun(bar.height) * 1.5)
width: workspacesRow.width + (Config.bar_spacing_fun(bar.height) * 2)
radius: height / 2
@@ -20,7 +20,7 @@ Rectangle {
Row {
id: workspacesRow
anchors.centerIn: parent
spacing: Config.spacing_fun(bar.height) / 2
spacing: Config.bar_spacing_fun(bar.height) / 2
Repeater {
model: Hyprland.workspaces
@@ -30,9 +30,9 @@ Rectangle {
id: wsItem
property var workspaceData: modelData
width: Math.max(40, wsIconsRow.width==0 ? wsNum.width + 2*Config.spacing_fun(bar.height) : wsNum.width + wsIconsRow.width + 3*Config.spacing_fun(bar.height)+Config.spacing_fun(bar.height))
width: Math.max(40, wsIconsRow.width==0 ? wsNum.width + 2*Config.bar_spacing_fun(bar.height) : wsNum.width + wsIconsRow.width + 3*Config.bar_spacing_fun(bar.height)+Config.bar_spacing_fun(bar.height))
// width: {
// var spacing = Config.spacing_fun(bar.height)
// var spacing = Config.bar_spacing_fun(bar.height)
// var cw = wsNum.width
// if (wsIconsRow.children.length > 0) {
// cw += spacing + wsIconsRow.width + spacing
@@ -47,7 +47,7 @@ Rectangle {
Rectangle {
anchors.centerIn: parent
width: parent.width
height: parent.height - (Config.spacing_fun(bar.height) * 1.5)
height: parent.height - (Config.bar_spacing_fun(bar.height) * 1.5)
radius: height / 2
@@ -79,9 +79,9 @@ Rectangle {
Row {
anchors.left: parent.left
anchors.leftMargin: wsIconsRow.width==0 ? (wsItem.width-wsNum.width)/2 : (wsItem.width-wsNum.width-wsIconsRow.width-Config.spacing_fun(bar.height))/2
anchors.leftMargin: wsIconsRow.width==0 ? (wsItem.width-wsNum.width)/2 : (wsItem.width-wsNum.width-wsIconsRow.width-Config.bar_spacing_fun(bar.height))/2
anchors.verticalCenter: parent.verticalCenter
spacing: Config.spacing_fun(bar.height)
spacing: Config.bar_spacing_fun(bar.height)
Text {
id: wsNum
@@ -97,7 +97,7 @@ Rectangle {
Row {
id: wsIconsRow
spacing: Config.spacing_fun(workspacesContainer.height)
spacing: Config.bar_spacing_fun(workspacesContainer.height)
anchors.verticalCenter: parent.verticalCenter
Repeater {