From ea6b8e0c02014d97ec1e6e39e4bbe1e8da872ed3 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Mon, 8 Sep 2025 15:53:50 -0400 Subject: [PATCH] Icons: Brightness and battery --- Modules/Bar/Widgets/Battery.qml | 5 ++- Modules/Bar/Widgets/Brightness.qml | 3 +- Modules/LockScreen/LockScreen.qml | 2 +- .../SettingsPanel/Bar/BarSectionEditor.qml | 2 +- .../Bar/BarWidgetSettingsDialog.qml | 2 +- .../WidgetSettings/SystemMonitorSettings.qml | 2 +- Modules/SettingsPanel/SettingsPanel.qml | 4 +-- Modules/SettingsPanel/Tabs/AboutTab.qml | 2 +- Modules/SettingsPanel/Tabs/AudioTab.qml | 2 +- Modules/SettingsPanel/Tabs/GeneralTab.qml | 2 +- .../Tabs/WallpaperSelectorTab.qml | 2 +- Modules/SidePanel/Cards/MediaCard.qml | 6 ++-- Modules/SidePanel/Cards/ProfileCard.qml | 2 +- Services/BatteryService.qml | 34 ++++--------------- Services/FontService.qml | 16 ++++++--- Widgets/NColorPickerDialog.qml | 2 +- Widgets/NPill.qml | 2 -- Widgets/NToast.qml | 12 +------ 18 files changed, 36 insertions(+), 66 deletions(-) diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index 9b8aef5..078d7f4 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -39,7 +39,7 @@ Item { // Test mode readonly property bool testMode: false readonly property int testPercent: 50 - readonly property bool testCharging: true + readonly property bool testCharging: false // Main properties readonly property var battery: UPower.displayDevice @@ -87,8 +87,7 @@ Item { rightOpen: BarWidgetRegistry.getNPillDirection(root) icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent, charging, isReady) - iconRotation: -90 - text: ((isReady && battery.isLaptopBattery) || testMode) ? Math.round(percent) + "%" : "-" + text: (isReady || testMode) ? Math.round(percent) + "%" : "-" textColor: charging ? Color.mPrimary : Color.mOnSurface iconCircleColor: Color.mPrimary collapsedIconColor: Color.mOnSurface diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 30948c3..4c3cb0e 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -46,8 +46,7 @@ Item { function getIcon() { var monitor = getMonitor() var brightness = monitor ? monitor.brightness : 0 - return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness - < 0.66 ? "brightness_medium" : "brightness_high" + return brightness <= 0.5 ? FontService.icons["brightness_low"] : FontService.icons["brightness_high"] } // Connection used to open the pill when brightness changes diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 25b69b1..dfe77a6 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -328,7 +328,7 @@ Loader { width: 100 * scaling height: 100 * scaling imagePath: Settings.data.general.avatarImage - fallbackIcon: "person" + fallbackIcon: FontService.icons["person"] } MouseArea { diff --git a/Modules/SettingsPanel/Bar/BarSectionEditor.qml b/Modules/SettingsPanel/Bar/BarSectionEditor.qml index c2a2631..4f0bba4 100644 --- a/Modules/SettingsPanel/Bar/BarSectionEditor.qml +++ b/Modules/SettingsPanel/Bar/BarSectionEditor.qml @@ -85,7 +85,7 @@ NBox { } NIconButton { - icon: "add" + icon: FontService.icons["add"] colorBg: Color.mPrimary colorFg: Color.mOnPrimary diff --git a/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml b/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml index c354b7b..e0cf418 100644 --- a/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml +++ b/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml @@ -120,7 +120,7 @@ Popup { NButton { text: "Apply" - icon: "check" + icon: FontService.icons["check"] onClicked: { if (settingsLoader.item && settingsLoader.item.saveSettings) { var newSettings = settingsLoader.item.saveSettings() diff --git a/Modules/SettingsPanel/Bar/WidgetSettings/SystemMonitorSettings.qml b/Modules/SettingsPanel/Bar/WidgetSettings/SystemMonitorSettings.qml index 4f2459b..21d0d4c 100644 --- a/Modules/SettingsPanel/Bar/WidgetSettings/SystemMonitorSettings.qml +++ b/Modules/SettingsPanel/Bar/WidgetSettings/SystemMonitorSettings.qml @@ -59,7 +59,7 @@ ColumnLayout { NToggle { id: showMemoryAsPercent Layout.fillWidth: true - label: "Show memory as percentage" + label: "Memory as percentage" checked: valueShowMemoryAsPercent onToggled: checked => valueShowMemoryAsPercent = checked } diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index 7de6a1b..69908f5 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -163,7 +163,7 @@ NPanel { }, { "id": SettingsPanel.Tab.ColorScheme, "label": "Color Scheme", - "icon": "paint_bucket", + "icon": "paint_drop", "source": colorSchemeTab }, { "id": SettingsPanel.Tab.Wallpaper, @@ -190,7 +190,7 @@ NPanel { }, { "id": SettingsPanel.Tab.Hooks, "label": "Hooks", - "icon": "cable", + "icon": "link", "source": hooksTab }, { "id": SettingsPanel.Tab.About, diff --git a/Modules/SettingsPanel/Tabs/AboutTab.qml b/Modules/SettingsPanel/Tabs/AboutTab.qml index 1fffadb..3dc3f2d 100644 --- a/Modules/SettingsPanel/Tabs/AboutTab.qml +++ b/Modules/SettingsPanel/Tabs/AboutTab.qml @@ -172,7 +172,7 @@ ColumnLayout { imagePath: modelData.avatar_url || "" anchors.fill: parent anchors.margins: Style.marginXS * scaling - fallbackIcon: "person" + fallbackIcon: FontService.icons["person"] borderColor: contributorArea.containsMouse ? Color.mOnTertiary : Color.mPrimary borderWidth: Math.max(1, Style.borderM * scaling) diff --git a/Modules/SettingsPanel/Tabs/AudioTab.qml b/Modules/SettingsPanel/Tabs/AudioTab.qml index b72047a..3473a43 100644 --- a/Modules/SettingsPanel/Tabs/AudioTab.qml +++ b/Modules/SettingsPanel/Tabs/AudioTab.qml @@ -272,7 +272,7 @@ ColumnLayout { // Button aligned to the center of the actual input field NIconButton { - icon: "add" + icon: FontService.icons["add"] Layout.alignment: Qt.AlignBottom Layout.bottomMargin: blacklistInput.description ? Style.marginS * scaling : 0 onClicked: { diff --git a/Modules/SettingsPanel/Tabs/GeneralTab.qml b/Modules/SettingsPanel/Tabs/GeneralTab.qml index fe4dbcd..c302217 100644 --- a/Modules/SettingsPanel/Tabs/GeneralTab.qml +++ b/Modules/SettingsPanel/Tabs/GeneralTab.qml @@ -19,7 +19,7 @@ ColumnLayout { width: 108 * scaling height: 108 * scaling imagePath: Settings.data.general.avatarImage - fallbackIcon: "person" + fallbackIcon: FontService.icons["person"] borderColor: Color.mPrimary borderWidth: Math.max(1, Style.borderM * scaling) Layout.alignment: Qt.AlignTop diff --git a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml index 0036a64..d267803 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml @@ -59,7 +59,7 @@ ColumnLayout { anchors.fill: parent anchors.margins: Style.marginXS * scaling imagePath: currentWallpaper - fallbackIcon: "image" + fallbackIcon: FontService.icons["image"] imageRadius: Style.radiusM * scaling borderColor: Color.mSecondary borderWidth: Style.borderL * 2 * scaling diff --git a/Modules/SidePanel/Cards/MediaCard.qml b/Modules/SidePanel/Cards/MediaCard.qml index a28f83a..369dcf5 100644 --- a/Modules/SidePanel/Cards/MediaCard.qml +++ b/Modules/SidePanel/Cards/MediaCard.qml @@ -162,7 +162,7 @@ NBox { anchors.fill: parent anchors.margins: Style.marginXS * scaling imagePath: MediaService.trackArtUrl - fallbackIcon: "music_note" + fallbackIcon: FontService.icons["vinyl"] borderColor: Color.mOutline borderWidth: Math.max(1, Style.borderS * scaling) } @@ -307,7 +307,7 @@ NBox { // Previous button NIconButton { - icon: "skip_previous" + icon: FontService.icons["previous"] tooltipText: "Previous Media" visible: MediaService.canGoPrevious onClicked: MediaService.canGoPrevious ? MediaService.previous() : {} @@ -323,7 +323,7 @@ NBox { // Next button NIconButton { - icon: "skip_next" + icon: FontService.icons["next"] tooltipText: "Next media" visible: MediaService.canGoNext onClicked: MediaService.canGoNext ? MediaService.next() : {} diff --git a/Modules/SidePanel/Cards/ProfileCard.qml b/Modules/SidePanel/Cards/ProfileCard.qml index 675d67b..42a3198 100644 --- a/Modules/SidePanel/Cards/ProfileCard.qml +++ b/Modules/SidePanel/Cards/ProfileCard.qml @@ -32,7 +32,7 @@ NBox { width: Style.baseWidgetSize * 1.25 * scaling height: Style.baseWidgetSize * 1.25 * scaling imagePath: Settings.data.general.avatarImage - fallbackIcon: "person" + fallbackIcon: FontService.icons["person"] borderColor: Color.mPrimary borderWidth: Math.max(1, Style.borderM * scaling) } diff --git a/Services/BatteryService.qml b/Services/BatteryService.qml index 6ceb872..2a9dfbb 100644 --- a/Services/BatteryService.qml +++ b/Services/BatteryService.qml @@ -2,6 +2,7 @@ pragma Singleton import Quickshell import Quickshell.Services.UPower +import qs.Services Singleton { id: root @@ -9,41 +10,18 @@ Singleton { // Choose icon based on charge and charging state function getIcon(percent, charging, isReady) { if (!isReady) { - return "battery_error" + return FontService.icons["battery_empty"] // FIXME: find battery error ? } if (charging) { - if (percent >= 95) - return "battery_full" - if (percent >= 85) - return "battery_charging_90" - if (percent >= 65) - return "battery_charging_80" - if (percent >= 55) - return "battery_charging_60" - if (percent >= 45) - return "battery_charging_50" - if (percent >= 25) - return "battery_charging_30" - if (percent >= 0) - return "battery_charging_20" + return FontService.icons["battery_charging"] } else { - if (percent >= 95) - return "battery_full" if (percent >= 85) - return "battery_6_bar" - if (percent >= 70) - return "battery_5_bar" - if (percent >= 55) - return "battery_4_bar" - if (percent >= 40) - return "battery_3_bar" + return FontService.icons["battery_full"] if (percent >= 25) - return "battery_2_bar" - if (percent >= 10) - return "battery_1_bar" + return FontService.icons["battery_low"] if (percent >= 0) - return "battery_0_bar" + return FontService.icons["battery_empty"] } } } diff --git a/Services/FontService.qml b/Services/FontService.qml index 46ef26c..ceccb30 100644 --- a/Services/FontService.qml +++ b/Services/FontService.qml @@ -29,13 +29,14 @@ Singleton { "volume_off": "\uF026", "volume_half": "\uF027", "volume_full": "\uF028", + "brightness_low": "\uF1CF", + "brightness_high": "\uF1CD", "power": "\uf011", "gear": "\ue615", "close": "\uf00D", "check": "\uf00C", "panel": "\uF28C", "memory": "\uF2D6", - "trash": "\uF014", "image": "\uF03E", "refresh": "\uF021", @@ -57,17 +58,22 @@ Singleton { "stop": "\uEFFB", "next": "\uF051", "prev": "\uF048", - "paint_drop": "\uF043", + "paint_drop": "\uF30C", "lightning": "\uF0E7", "brightness": "\uF0A3", "arrow_drop_down": "\uF0D7", - + "warning": "\uF334", + "info": "\uF26A", + "upload": "\uF01B", + "download": "\uF01A", "vinyl": "\uEFBD", + "link": "\uF0C1", + "add": "\uF055", // FIXME UGLY "bell": "\uF189", "bell_striked": "\uEE15", // FIXME "drive": "\uEE15", // FIXME - "upload": "\uEE15", // FIXME - "download": "\uEE15", // FIXME + "person": "\uEE15", // FIXME + } diff --git a/Widgets/NColorPickerDialog.qml b/Widgets/NColorPickerDialog.qml index 07b9647..2bcb395 100644 --- a/Widgets/NColorPickerDialog.qml +++ b/Widgets/NColorPickerDialog.qml @@ -502,7 +502,7 @@ Popup { NButton { text: "Apply" - icon: "check" + icon: FontService.icons["check"] customHeight: 36 * scaling customWidth: 100 * scaling onClicked: { diff --git a/Widgets/NPill.qml b/Widgets/NPill.qml index 2011c9d..a30e2c7 100644 --- a/Widgets/NPill.qml +++ b/Widgets/NPill.qml @@ -15,7 +15,6 @@ Item { property color iconTextColor: Color.mSurface property color collapsedIconColor: Color.mOnSurface - property real iconRotation: 0 property real sizeRatio: 0.8 property bool autoHide: false property bool forceOpen: false @@ -119,7 +118,6 @@ Item { NIcon { text: root.icon - rotation: root.iconRotation font.pointSize: Style.fontSizeM * scaling // When forced shown, use pill text color; otherwise accent color when hovered color: forceOpen ? textColor : (showPill ? iconTextColor : Color.mOnSurface) diff --git a/Widgets/NToast.qml b/Widgets/NToast.qml index 8e279b3..8fc882d 100644 --- a/Widgets/NToast.qml +++ b/Widgets/NToast.qml @@ -118,17 +118,7 @@ Item { // Icon NIcon { id: icon - text: { - switch (root.type) { - case "warning": - return "warning" - case "notice": - return "info" - default: - return "info" - } - } - + text: (root.type == "warning") ? FontService.icons["warning"] : FontService.icons["info"] color: { switch (root.type) { case "warning":