From 7639900f38d29ae76ae8c92404cc7b5cbac505db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Atoch?= Date: Sun, 3 Aug 2025 22:51:01 -0400 Subject: [PATCH 1/4] Bar/Battery: improved tooltip and handle negative charging rate - Also slightly tweaked StyledTooltip minimum size to avoid inconsistencies (Tooltip with a single line looked like pills instead of rounded rectangles) --- Bar/Modules/Battery.qml | 41 +++++++++++++++++++++++++++--------- Components/StyledTooltip.qml | 4 ++-- Helpers/Time.js | 18 ++++++++++++++++ 3 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 Helpers/Time.js diff --git a/Bar/Modules/Battery.qml b/Bar/Modules/Battery.qml index d4ccd2c..03af9c3 100644 --- a/Bar/Modules/Battery.qml +++ b/Bar/Modules/Battery.qml @@ -4,6 +4,7 @@ import Quickshell.Services.UPower import QtQuick.Layouts import qs.Components import qs.Settings +import "../../Helpers/Time.js" as Time Item { id: batteryWidget @@ -76,17 +77,37 @@ Item { positionAbove: false text: { let lines = []; - if (batteryWidget.isReady) { + if (!batteryWidget.isReady) { + return ""; + } + + if (batteryWidget.battery.timeToEmpty > 0) { + lines.push("Time left: " + Time.formatVagueHumanReadableTime(batteryWidget.battery.timeToEmpty)); + } + + if (batteryWidget.battery.timeToFull > 0) { + lines.push("Time until full: " + Time.formatVagueHumanReadableTime(batteryWidget.battery.timeToFull)); + } + + if (batteryWidget.battery.changeRate !== undefined) { + const rate = batteryWidget.battery.changeRate; + if (rate > 0) { + lines.push(batteryWidget.charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(2) + " W"); + } + else if (rate < 0) { + lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W"); + } + else { + lines.push("Estimating..."); + } + } + else { lines.push(batteryWidget.charging ? "Charging" : "Discharging"); - lines.push(Math.round(batteryWidget.percent) + "%"); - if (batteryWidget.battery.changeRate !== undefined) - lines.push("Rate: " + batteryWidget.battery.changeRate.toFixed(2) + " W"); - if (batteryWidget.battery.timeToEmpty > 0) - lines.push("Time left: " + Math.floor(batteryWidget.battery.timeToEmpty / 60) + " min"); - if (batteryWidget.battery.timeToFull > 0) - lines.push("Time to full: " + Math.floor(batteryWidget.battery.timeToFull / 60) + " min"); - if (batteryWidget.battery.healthPercentage !== undefined) - lines.push("Health: " + Math.round(batteryWidget.battery.healthPercentage) + "%"); + } + + + if (batteryWidget.battery.healthPercentage !== undefined && batteryWidget.battery.healthPercentage > 0) { + lines.push("Health: " + Math.round(batteryWidget.battery.healthPercentage) + "%"); } return lines.join("\n"); } diff --git a/Components/StyledTooltip.qml b/Components/StyledTooltip.qml index fed3d1c..9c30baf 100644 --- a/Components/StyledTooltip.qml +++ b/Components/StyledTooltip.qml @@ -16,8 +16,8 @@ Window { color: "transparent" visible: false - minimumWidth: tooltipText.implicitWidth + 24 - minimumHeight: tooltipText.implicitHeight + 16 + minimumWidth: Math.max(50, tooltipText.implicitWidth + 24) + minimumHeight: Math.max(50, tooltipText.implicitHeight + 16) property var _timerObj: null onTooltipVisibleChanged: { diff --git a/Helpers/Time.js b/Helpers/Time.js new file mode 100644 index 0000000..7e1e316 --- /dev/null +++ b/Helpers/Time.js @@ -0,0 +1,18 @@ +function formatVagueHumanReadableTime(totalSeconds) { + const hours = Math.floor(totalSeconds / 3600); + const minutes = Math.floor((totalSeconds - (hours * 3600)) / 60); + const seconds = totalSeconds - (hours * 3600) - (minutes * 60); + + var str = ""; + if (hours) { + str += hours.toString() + "h"; + } + if (minutes) { + str += minutes.toString() + "m"; + } + if (!hours && !minutes) { + str += seconds.toString() + "s"; + } + return str; +} + From 01be1f0bda804b93daf1d56d4a49cfdc76313f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Atoch?= Date: Sun, 3 Aug 2025 22:51:37 -0400 Subject: [PATCH 2/4] Bar/Volume tooltip: reworded so it's not that big --- Bar/Modules/Volume.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bar/Modules/Volume.qml b/Bar/Modules/Volume.qml index a7082fd..36e2be6 100644 --- a/Bar/Modules/Volume.qml +++ b/Bar/Modules/Volume.qml @@ -47,7 +47,7 @@ Item { StyledTooltip { id: volumeTooltip - text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection." + text: "Volume: " + volume + "%\nLeft click for advanced settings.\nScroll up/down to change volume." positionAbove: false tooltipVisible: !ioSelector.visible && volumeDisplay.containsMouse targetItem: pillIndicator From 5e2ad9dec653d9e97aae14e5b4faa5c09424bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Atoch?= Date: Sun, 3 Aug 2025 22:52:59 -0400 Subject: [PATCH 3/4] Border radius uniformisation We had a lot of radius 20, 22 and 24 which led to design inconsistencies. Set them all to 20. --- Bar/Modules/Applauncher.qml | 2 +- Widgets/LockScreen/LockScreen.qml | 4 ++-- Widgets/Sidebar/Config/SettingsModal.qml | 2 +- Widgets/Sidebar/Panel/BluetoothPanel.qml | 2 +- Widgets/Sidebar/Panel/WallpaperPanel.qml | 2 +- Widgets/Sidebar/Panel/WifiPanel.qml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Bar/Modules/Applauncher.qml b/Bar/Modules/Applauncher.qml index 50085c2..5c7cc67 100644 --- a/Bar/Modules/Applauncher.qml +++ b/Bar/Modules/Applauncher.qml @@ -214,7 +214,7 @@ PanelWithOverlay { Rectangle { id: searchBar color: Theme.surfaceVariant - radius: 22 + radius: 20 height: 48 Layout.fillWidth: true border.color: searchField.activeFocus ? Theme.accentPrimary : Theme.outline diff --git a/Widgets/LockScreen/LockScreen.qml b/Widgets/LockScreen/LockScreen.qml index 8e19ff2..2eaf479 100644 --- a/Widgets/LockScreen/LockScreen.qml +++ b/Widgets/LockScreen/LockScreen.qml @@ -240,7 +240,7 @@ WlSessionLock { width: parent.width * 0.8 height: 44 color: Theme.overlay - radius: 22 + radius: 20 visible: lock.errorMessage !== "" Text { @@ -258,7 +258,7 @@ WlSessionLock { Layout.alignment: Qt.AlignHCenter width: 120 height: 44 - radius: 22 + radius: 20 opacity: unlockButtonArea.containsMouse ? 0.8 : 0.5 color: unlockButtonArea.containsMouse ? Theme.accentPrimary : Theme.surface border.color: Theme.accentPrimary diff --git a/Widgets/Sidebar/Config/SettingsModal.qml b/Widgets/Sidebar/Config/SettingsModal.qml index 3b97f86..056f6f5 100644 --- a/Widgets/Sidebar/Config/SettingsModal.qml +++ b/Widgets/Sidebar/Config/SettingsModal.qml @@ -22,7 +22,7 @@ PanelWindow { Rectangle { anchors.fill: parent color: Theme.backgroundPrimary - radius: 24 + radius: 20 z: 0 ColumnLayout { diff --git a/Widgets/Sidebar/Panel/BluetoothPanel.qml b/Widgets/Sidebar/Panel/BluetoothPanel.qml index f87aa8f..155f29f 100644 --- a/Widgets/Sidebar/Panel/BluetoothPanel.qml +++ b/Widgets/Sidebar/Panel/BluetoothPanel.qml @@ -90,7 +90,7 @@ Item { Rectangle { anchors.fill: parent color: Theme.backgroundPrimary - radius: 24 + radius: 20 ColumnLayout { anchors.fill: parent diff --git a/Widgets/Sidebar/Panel/WallpaperPanel.qml b/Widgets/Sidebar/Panel/WallpaperPanel.qml index 4a69a0f..0cf3166 100644 --- a/Widgets/Sidebar/Panel/WallpaperPanel.qml +++ b/Widgets/Sidebar/Panel/WallpaperPanel.qml @@ -40,7 +40,7 @@ PanelWindow { Rectangle { anchors.fill: parent color: Theme.backgroundPrimary - radius: 24 + radius: 20 ColumnLayout { anchors.fill: parent anchors.margins: 32 diff --git a/Widgets/Sidebar/Panel/WifiPanel.qml b/Widgets/Sidebar/Panel/WifiPanel.qml index fc88e0c..cdc6b30 100644 --- a/Widgets/Sidebar/Panel/WifiPanel.qml +++ b/Widgets/Sidebar/Panel/WifiPanel.qml @@ -482,7 +482,7 @@ Item { Rectangle { anchors.fill: parent color: Theme.backgroundPrimary - radius: 24 + radius: 20 ColumnLayout { anchors.fill: parent anchors.margins: 32 @@ -590,7 +590,7 @@ Item { anchors.fill: parent spacing: 4 boundsBehavior: Flickable.StopAtBounds - model: Object.values(wifiLogic.networks) + model: wifiLogic.networks ? Object.values(wifiLogic.networks) : null delegate: Item { id: networkEntry From 8bb7bbda1462a94a82a0ab304eca74b3d64d0390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Atoch?= Date: Sun, 3 Aug 2025 22:55:59 -0400 Subject: [PATCH 4/4] Avatar: Back to Image instead of IconImage due to a rendering bug - Took many screenshots and compared them in GIMP and it's true, IconImage is a not as sharp as Image. Bug was already reported on Quickshell github https://github.com/quickshell-mirror/quickshell/issues/128 --- Components/Avatar.qml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Components/Avatar.qml b/Components/Avatar.qml index 0c879bb..3a369bd 100644 --- a/Components/Avatar.qml +++ b/Components/Avatar.qml @@ -6,20 +6,17 @@ import QtQuick.Effects Item { anchors.fill: parent + anchors.margins: 2 - anchors.leftMargin: 2 - anchors.rightMargin: 2 - anchors.topMargin: 2 - anchors.bottomMargin: 2 - - IconImage { + Image { id: avatarImage anchors.fill: parent - anchors.margins: 2 source: "file://" + Settings.settings.profileImage visible: false + mipmap: true + smooth: true asynchronous: true - backer.fillMode: Image.PreserveAspectCrop + fillMode: Image.PreserveAspectCrop } MultiEffect {