forked from Shinonome/dots-hyprland
bar: make resource numbers have fixed width
This commit is contained in:
@@ -32,7 +32,7 @@ Item {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: resourceRowLayout
|
id: resourceRowLayout
|
||||||
spacing: 4
|
spacing: 2
|
||||||
x: shown ? 0 : -resourceRowLayout.width
|
x: shown ? 0 : -resourceRowLayout.width
|
||||||
|
|
||||||
CircularProgress {
|
CircularProgress {
|
||||||
@@ -53,10 +53,22 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
Item {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: Appearance.colors.colOnLayer1
|
implicitWidth: fullPercentageTextMetrics.width
|
||||||
text: `${Math.round(percentage * 100)}`
|
implicitHeight: percentageText.implicitHeight
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: fullPercentageTextMetrics
|
||||||
|
text: "100"
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: percentageText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: Appearance.colors.colOnLayer1
|
||||||
|
text: `${Math.round(percentage * 100).toString()}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Item {
|
|||||||
shown: (Config.options.bar.resources.alwaysShowSwap && percentage > 0) ||
|
shown: (Config.options.bar.resources.alwaysShowSwap && percentage > 0) ||
|
||||||
(MprisController.activePlayer?.trackTitle == null) ||
|
(MprisController.activePlayer?.trackTitle == null) ||
|
||||||
root.alwaysShowAllResources
|
root.alwaysShowAllResources
|
||||||
Layout.leftMargin: shown ? 4 : 0
|
Layout.leftMargin: shown ? 6 : 0
|
||||||
|
|
||||||
tooltipHeaderIcon: "swap_horiz"
|
tooltipHeaderIcon: "swap_horiz"
|
||||||
tooltipHeaderText: Translation.tr("Swap usage")
|
tooltipHeaderText: Translation.tr("Swap usage")
|
||||||
@@ -58,7 +58,7 @@ Item {
|
|||||||
shown: Config.options.bar.resources.alwaysShowCpu ||
|
shown: Config.options.bar.resources.alwaysShowCpu ||
|
||||||
!(MprisController.activePlayer?.trackTitle?.length > 0) ||
|
!(MprisController.activePlayer?.trackTitle?.length > 0) ||
|
||||||
root.alwaysShowAllResources
|
root.alwaysShowAllResources
|
||||||
Layout.leftMargin: shown ? 4 : 0
|
Layout.leftMargin: shown ? 6 : 0
|
||||||
|
|
||||||
tooltipHeaderIcon: "settings_slow_motion"
|
tooltipHeaderIcon: "settings_slow_motion"
|
||||||
tooltipHeaderText: Translation.tr("CPU usage")
|
tooltipHeaderText: Translation.tr("CPU usage")
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ ProgressBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
anchors.fill: parent
|
|
||||||
implicitHeight: valueBarHeight
|
implicitHeight: valueBarHeight
|
||||||
implicitWidth: valueBarWidth
|
implicitWidth: valueBarWidth
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user