diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-28 13:25:48 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-28 13:25:48 +1000 |
| commit | af53c7b20378b9f1c2d18d4afb8b44c258b40955 (patch) | |
| tree | 0cab398cdd33a454454fcb6c037d1c05bbd2646c /modules | |
| parent | readme: add new config options (diff) | |
| download | caelestia-shell-af53c7b20378b9f1c2d18d4afb8b44c258b40955.tar.gz caelestia-shell-af53c7b20378b9f1c2d18d4afb8b44c258b40955.tar.bz2 caelestia-shell-af53c7b20378b9f1c2d18d4afb8b44c258b40955.zip | |
media: display hh:mm:ss
Closes #287
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/dashboard/Media.qml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/dashboard/Media.qml b/modules/dashboard/Media.qml index a7cda85..ba0c8f3 100644 --- a/modules/dashboard/Media.qml +++ b/modules/dashboard/Media.qml @@ -26,7 +26,14 @@ Item { function lengthStr(length: int): string { if (length < 0) return "-1:-1"; - return `${Math.floor(length / 60)}:${Math.floor(length % 60).toString().padStart(2, "0")}`; + + const hours = Math.floor(length / 3600); + const mins = Math.floor((length % 3600) / 60); + const secs = Math.floor(length % 60).toString().padStart(2, "0"); + + if (hours > 0) + return `${hours}:${mins.toString().padStart(2, "0")}:${secs}`; + return `${mins}:${secs}`; } implicitWidth: cover.implicitWidth + Config.dashboard.sizes.mediaVisualiserSize * 2 + details.implicitWidth + details.anchors.leftMargin + bongocat.implicitWidth + bongocat.anchors.leftMargin * 2 + Appearance.padding.large * 2 |