feat: refactor bar spacing functions to use dedicated functions
This commit is contained in:
@@ -6,7 +6,7 @@ import Quickshell.Hyprland
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioRow.width + Config.spacing_fun(height)*3.5, height)
|
||||
width: Math.max(audioRow.width + Config.bar_spacing_fun(height)*3.5, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -22,9 +22,9 @@ MouseArea {
|
||||
|
||||
Row {
|
||||
id: audioRow
|
||||
width: audioSourceText.width + audioSinkText.width + audioPercentageText.width + Config.spacing_fun(height)*2
|
||||
width: audioSourceText.width + audioSinkText.width + audioPercentageText.width + Config.bar_spacing_fun(height)*2
|
||||
height: parent.height
|
||||
spacing: Config.spacing_fun(height)/2
|
||||
spacing: Config.bar_spacing_fun(height)/2
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
@@ -35,7 +35,7 @@ MouseArea {
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
rightPadding: Config.spacing_fun(height)*1.5
|
||||
rightPadding: Config.bar_spacing_fun(height)*1.5
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
@@ -5,7 +5,7 @@ import "../states/Audio"
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(audioText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -6,7 +6,7 @@ import "../states/Battery"
|
||||
|
||||
MouseArea {
|
||||
id: batteryButton
|
||||
width: expanded ? Math.max(expandedRow.width + Config.spacing_fun(height)*3, bar.height) : Math.max(batteryText.width + Config.spacing_fun(height)*2, bar.height)
|
||||
width: expanded ? Math.max(expandedRow.width + Config.bar_spacing_fun(height)*3, bar.height) : Math.max(batteryText.width + Config.bar_spacing_fun(height)*2, bar.height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -63,7 +63,7 @@ MouseArea {
|
||||
id: expandedRow
|
||||
visible: expanded
|
||||
anchors.centerIn: parent
|
||||
spacing: Config.spacing_fun(batteryButton.height)
|
||||
spacing: Config.bar_spacing_fun(batteryButton.height)
|
||||
|
||||
Text {
|
||||
id: batteryPercentageSymbol
|
||||
@@ -121,7 +121,7 @@ MouseArea {
|
||||
id: batteryPopup
|
||||
anchorItem: batteryButton
|
||||
anchorHovered: batteryButton.containsMouse
|
||||
spacingValue: Config.spacing_fun(batteryButton.height)
|
||||
spacingValue: Config.bar_spacing_fun(batteryButton.height)
|
||||
radiusValue: Config.radius_fun(batteryButton.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -6,7 +6,7 @@ import "../states/Clock"
|
||||
|
||||
Rectangle { //workspace
|
||||
id: clockRect
|
||||
width: ClockState.expanded ? Math.max(dateText.width + timeText.width + Config.spacing_fun(height)*3, bar.height) : Math.max(timeText.width + Config.spacing_fun(height)*2, bar.height)
|
||||
width: ClockState.expanded ? Math.max(dateText.width + timeText.width + Config.bar_spacing_fun(height)*3, bar.height) : Math.max(timeText.width + Config.bar_spacing_fun(height)*2, bar.height)
|
||||
height: bar.height
|
||||
radius: Config.radius_fun(height)
|
||||
color: clockArea.containsMouse ? Colors.tertiaryContainer : Colors.primaryContainer
|
||||
@@ -61,7 +61,7 @@ Rectangle { //workspace
|
||||
id: clockPopup
|
||||
anchorItem: clockRect
|
||||
anchorHovered: clockArea.containsMouse
|
||||
spacingValue: Config.spacing_fun(clockRect.height)
|
||||
spacingValue: Config.bar_spacing_fun(clockRect.height)
|
||||
radiusValue: Config.radius_fun(clockRect.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../states/Idle"
|
||||
|
||||
MouseArea {
|
||||
id: idleButton
|
||||
width: Math.max(idleText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(idleText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -5,7 +5,7 @@ import "../states/Network"
|
||||
MouseArea {
|
||||
id: networkButton
|
||||
|
||||
width: Math.max(networkText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(networkText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -37,7 +37,7 @@ MouseArea {
|
||||
id: clockPopup
|
||||
anchorItem: networkButton
|
||||
anchorHovered: networkButton.containsMouse
|
||||
spacingValue: Config.spacing_fun(networkButton.height)
|
||||
spacingValue: Config.bar_spacing_fun(networkButton.height)
|
||||
radiusValue: Config.radius_fun(networkButton.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -4,7 +4,7 @@ import "../../../config"
|
||||
|
||||
MouseArea {
|
||||
id: powerButton
|
||||
width: Math.max(powerText.width + Config.spacing_fun(height), height)
|
||||
width: Math.max(powerText.width + Config.bar_spacing_fun(height), height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../../../config"
|
||||
|
||||
Row { // Workspace Row
|
||||
id: trayRow
|
||||
spacing: Config.small_spacing_fun(height)
|
||||
spacing: Config.bar_small_bar_spacing_fun(height)
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
@@ -19,8 +19,8 @@ Row { // Workspace Row
|
||||
|
||||
Rectangle { //trayItem
|
||||
id: trayItem
|
||||
width: iconImage.width + Config.spacing_fun(bar.height)
|
||||
height: iconImage.height + Config.spacing_fun(bar.height)
|
||||
width: iconImage.width + Config.bar_spacing_fun(bar.height)
|
||||
height: iconImage.height + Config.bar_spacing_fun(bar.height)
|
||||
radius: Config.radius_fun(trayRow.height)
|
||||
color: trayArea.containsMouse ? Colors.tertiaryContainer
|
||||
: modelData.active ? Colors.primaryContainer
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../states/Apps"
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real pad: Config.spacing_fun(bar.height) * 1.5
|
||||
property real pad: Config.bar_spacing_fun(bar.height) * 1.5
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -39,7 +39,7 @@ Item {
|
||||
Row {
|
||||
|
||||
id: contentRow
|
||||
spacing: Config.spacing_fun(bar.height) * 1.25
|
||||
spacing: Config.bar_spacing_fun(bar.height) * 1.25
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user