Wrong position and forgot an import

This commit is contained in:
EinBowser
2025-11-01 23:26:36 +01:00
parent c2bb57f0bc
commit 0e63e698f2
2 changed files with 23 additions and 21 deletions
@@ -63,7 +63,28 @@ StyledPopup {
text: Battery.isCharging ? Translation.tr("Time to full:") : Translation.tr("Time to empty:")
color: Appearance.colors.colOnSurfaceVariant
}
RowLayout {
StyledText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
color: Appearance.colors.colOnSurfaceVariant
text: {
function formatTime(seconds) {
var h = Math.floor(seconds / 3600);
var m = Math.floor((seconds % 3600) / 60);
if (h > 0)
return `${h}h, ${m}m`;
else
return `${m}m`;
}
if (Battery.isCharging)
return formatTime(Battery.timeToFull);
else
return formatTime(Battery.timeToEmpty);
}
}
}
RowLayout {
spacing: 5
visible: Config.options.battery.showHealth
Layout.fillWidth: true
@@ -86,26 +107,6 @@ StyledPopup {
text: `${(Battery.health).toFixed(1)}%`
}
}
StyledText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
color: Appearance.colors.colOnSurfaceVariant
text: {
function formatTime(seconds) {
var h = Math.floor(seconds / 3600);
var m = Math.floor((seconds % 3600) / 60);
if (h > 0)
return `${h}h, ${m}m`;
else
return `${m}m`;
}
if (Battery.isCharging)
return formatTime(Battery.timeToFull);
else
return formatTime(Battery.timeToEmpty);
}
}
}
RowLayout {
spacing: 5
@@ -6,6 +6,7 @@ import Quickshell
import Quickshell.Services.UPower
import QtQuick
import Quickshell.Io
import qs.modules.common.functions
Singleton {
id: root