From 467c9bc0e376cb8314d52a7f043af70ba54d625c Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 5 Sep 2025 17:22:16 -0400 Subject: [PATCH] move lucide to Styling --- components/LucideIcon.qml | 6 +-- components/MprisController.qml | 7 ++- components/MprisPlayerSelector.qml | 6 +-- components/StyledIconButton.qml | 9 +--- config/Styling.qml | 44 +++++++++++++++++++ config/Theme.qml | 3 -- constants/Icons.qml | 36 --------------- modules/bar/components/Caffeine.qml | 3 +- modules/bar/components/Cpu.qml | 11 +---- modules/bar/components/Gpu.qml | 11 +---- modules/bar/components/Memory.qml | 9 +--- modules/bar/components/Network.qml | 15 +++---- modules/bar/components/Power.qml | 11 +++-- modules/bar/components/Pywal.qml | 4 +- modules/bar/components/Storage.qml | 11 +---- .../components/bluetooth/AvailableDevice.qml | 1 - .../bar/components/bluetooth/Bluetooth.qml | 4 +- .../components/bluetooth/ConnectedDevice.qml | 15 +++---- modules/bar/components/hyprland/Workspace.qml | 5 +-- .../notifications/Notifications.qml | 6 +-- modules/launcher/Launcher.qml | 3 +- modules/pomodoro/Pomodoro.qml | 3 +- modules/storybook/Storybook.qml | 3 +- 23 files changed, 91 insertions(+), 135 deletions(-) delete mode 100644 constants/Icons.qml diff --git a/components/LucideIcon.qml b/components/LucideIcon.qml index fa19612..3574856 100644 --- a/components/LucideIcon.qml +++ b/components/LucideIcon.qml @@ -2,13 +2,13 @@ import qs.config import QtQuick Text { + font.family: Styling.lucide.font.family + font.pixelSize: 16 + color: Theme.palette.basecontent Behavior on color { ColorAnimation { duration: Styling.animations.speed.fast } } - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.gpu.iconSize - font.bold: true } diff --git a/components/MprisController.qml b/components/MprisController.qml index bd05ee6..a6b6a88 100644 --- a/components/MprisController.qml +++ b/components/MprisController.qml @@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound import qs.components import qs.config -import qs.constants import QtQuick import QtQuick.Layouts import Quickshell.Services.Mpris @@ -29,21 +28,21 @@ Loader { Layout.alignment: Qt.AlignHCenter StyledIconButton { id: backButton - text: Icons.skipBack + text: Styling.lucide.icons.skipBack onClicked: { root.player.previous(); } } StyledIconButton { id: playPauseButton - text: root.player.isPlaying ? Icons.pause : Icons.play + text: root.player.isPlaying ? Styling.lucide.icons.pause : Styling.lucide.icons.play onClicked: { root.player.isPlaying = !root.player.isPlaying; } } StyledIconButton { id: forwardButton - text: Icons.skipForward + text: Styling.lucide.icons.skipForward onClicked: { root.player.next(); } diff --git a/components/MprisPlayerSelector.qml b/components/MprisPlayerSelector.qml index c185145..2a4a8c3 100644 --- a/components/MprisPlayerSelector.qml +++ b/components/MprisPlayerSelector.qml @@ -1,5 +1,5 @@ +import qs.config import qs.components -import qs.constants import qs.services import QtQuick import QtQuick.Layouts @@ -13,7 +13,7 @@ RowLayout { id: previousPlayerButton visible: Mpris.players.length > 1 - text: Icons.chevronLeft + text: Styling.lucide.icons.chevronLeft onClicked: { Mpris.previousPlayer(); @@ -42,7 +42,7 @@ RowLayout { id: nextPlayerButton visible: Mpris.players.length > 1 - text: Icons.chevronRight + text: Styling.lucide.icons.chevronRight onClicked: { Mpris.nextPlayer(); diff --git a/components/StyledIconButton.qml b/components/StyledIconButton.qml index d472462..7f725db 100644 --- a/components/StyledIconButton.qml +++ b/components/StyledIconButton.qml @@ -5,16 +5,11 @@ import QtQuick.Controls RoundButton { id: control - FontLoader { - id: loader - source: "../assets/lucide.woff" - } - property alias border: rect.border property color color: hovered ? Theme.palette.primarycontent : Theme.palette.basecontent property int rotation: 0 - font.family: loader.font.family + font.family: Styling.lucide.font.family font.pixelSize: 19 radius: 8 padding: 8 @@ -37,7 +32,7 @@ RoundButton { Behavior on rotation { RotationAnimation { duration: Styling.animations.speed.slow - easing.type: Easing.InOutCubic + easing.type: Easing.OutQuad } } } diff --git a/config/Styling.qml b/config/Styling.qml index be40e68..9fd15d8 100644 --- a/config/Styling.qml +++ b/config/Styling.qml @@ -6,6 +6,7 @@ import Quickshell Singleton { id: root + readonly property Lucide lucide: Lucide {} readonly property Animations animations: Animations {} component Animations: QtObject { @@ -18,4 +19,47 @@ Singleton { property int slow: 400 property int verySlow: 1000 } + + component Lucide: Item { + + readonly property alias font: loader.font + readonly property LucideIcons icons: LucideIcons {} + + FontLoader { + id: loader + source: "../assets/lucide.woff" + } + } + component LucideIcons: QtObject { + property string batteryCharging: "\u{E058}" + property string batteryFull: "\u{E059}" + property string batteryMedium: "\u{E05b}" + property string batteryLow: "\u{E05a}" + property string batteryWarning: "\u{E3b0}" + property string bell: "\u{E05d}" + property string bellRing: "\u{E224}" + property string bluetooth: "\u{E060}" + property string bluetoothConnected: "\u{E1b8}" + property string brickWall: "\u{E586}" + property string coffee: "\u{E09a}" + property string chevronLeft: "\u{E072}" + property string chevronRight: "\u{E073}" + property string cpu: "\u{E0ad}" + property string gpu: "\u{E66f}" + property string hardDrive: "\u{E0f1}" + property string memoryStick: "\u{E44a}" + property string pause: "\u{E132}" + property string play: "\u{E140}" + property string search: "\u{E155}" + property string skipBack: "\u{E163}" + property string skipForward: "\u{E164}" + property string stop: "\u{E132}" + property string square: "\u{E16B}" + property string wifiOff: "\u{E1af}" + property string wifiLow: "\u{E5fd}" + property string wifiHigh: "\u{E5fc}" + property string wifi: "\u{E1ae}" + property string triangle: "\u{E192}" + property string triangleDashed: "\u{E642}" + } } diff --git a/config/Theme.qml b/config/Theme.qml index b686079..82c316a 100644 --- a/config/Theme.qml +++ b/config/Theme.qml @@ -8,9 +8,6 @@ import Quickshell.Io Singleton { id: root - property var lucide: FontLoader { - source: "../assets/lucide.woff" - } property string fontFamily: "JetBrainsMono Nerd Font" property var palette: theme.palette diff --git a/constants/Icons.qml b/constants/Icons.qml deleted file mode 100644 index 881277e..0000000 --- a/constants/Icons.qml +++ /dev/null @@ -1,36 +0,0 @@ -pragma Singleton - -import Quickshell - -Singleton { - property string batteryCharging: "\u{E058}" - property string batteryFull: "\u{E059}" - property string batteryMedium: "\u{E05b}" - property string batteryLow: "\u{E05a}" - property string batteryWarning: "\u{E3b0}" - property string bell: "\u{E05d}" - property string bellRing: "\u{E224}" - property string bluetooth: "\u{E060}" - property string bluetoothConnected: "\u{E1b8}" - property string brickWall: "\u{E586}" - property string coffee: "\u{E09a}" - property string chevronLeft: "\u{E072}" - property string chevronRight: "\u{E073}" - property string cpu: "\u{E0ad}" - property string gpu: "\u{E66f}" - property string hardDrive: "\u{E0f1}" - property string memoryStick: "\u{E44a}" - property string pause: "\u{E132}" - property string play: "\u{E140}" - property string search: "\u{E155}" - property string skipBack: "\u{E163}" - property string skipForward: "\u{E164}" - property string stop: "\u{E132}" - property string square: "\u{E16B}" - property string wifiOff: "\u{E1af}" - property string wifiLow: "\u{E5fd}" - property string wifiHigh: "\u{E5fc}" - property string wifi: "\u{E1ae}" - property string triangle: "\u{E192}" - property string triangleDashed: "\u{E642}" -} diff --git a/modules/bar/components/Caffeine.qml b/modules/bar/components/Caffeine.qml index 47a80c4..a2ac7b0 100644 --- a/modules/bar/components/Caffeine.qml +++ b/modules/bar/components/Caffeine.qml @@ -1,6 +1,5 @@ import qs.components import qs.config -import qs.constants import qs.services StyledIconButton { @@ -8,7 +7,7 @@ StyledIconButton { border.width: 2 border.color: Caffeine.enabled ? Theme.palette.secondary : root.hovered ? Theme.palette.primary : Theme.palette.base300 - text: Icons.coffee + text: Styling.lucide.icons.coffee onClicked: { Caffeine.toggle(); diff --git a/modules/bar/components/Cpu.qml b/modules/bar/components/Cpu.qml index 41085be..b0b46ed 100644 --- a/modules/bar/components/Cpu.qml +++ b/modules/bar/components/Cpu.qml @@ -1,9 +1,7 @@ import qs.components import qs.config -import qs.constants import qs.services import qs.utils -import qs.widgets import QtQuick import QtQuick.Layouts @@ -24,13 +22,8 @@ StyledButton { Ref { service: SystemInfo } - StyledText { - id: icon - - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.cpu.iconSize - font.bold: true - text: Icons.cpu + LucideIcon { + text: Styling.lucide.icons.cpu color: root.hovered ? Theme.palette.primarycontent : Theme.palette.basecontent } diff --git a/modules/bar/components/Gpu.qml b/modules/bar/components/Gpu.qml index fa29708..1e29627 100644 --- a/modules/bar/components/Gpu.qml +++ b/modules/bar/components/Gpu.qml @@ -1,9 +1,7 @@ import qs.components import qs.config -import qs.constants import qs.services import qs.utils -import qs.widgets import QtQuick import QtQuick.Layouts @@ -24,13 +22,8 @@ StyledButton { Ref { service: SystemInfo } - StyledText { - id: icon - - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.gpu.iconSize - font.bold: true - text: Icons.gpu + LucideIcon { + text: Styling.lucide.icons.gpu color: root.hovered ? Theme.palette.primarycontent : Theme.palette.basecontent } diff --git a/modules/bar/components/Memory.qml b/modules/bar/components/Memory.qml index 24a967a..1f251e6 100644 --- a/modules/bar/components/Memory.qml +++ b/modules/bar/components/Memory.qml @@ -1,8 +1,6 @@ import qs.components import qs.config -import qs.constants import qs.services -import qs.widgets import qs.utils import QtQuick import QtQuick.Layouts @@ -12,11 +10,8 @@ StyledLabel { Ref { service: SystemInfo } - StyledText { - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.memory.iconSize - font.bold: true - text: Icons.memoryStick + LucideIcon { + text: Styling.lucide.icons.memoryStick } StyledText { diff --git a/modules/bar/components/Network.qml b/modules/bar/components/Network.qml index f89010d..4fa89cd 100644 --- a/modules/bar/components/Network.qml +++ b/modules/bar/components/Network.qml @@ -1,9 +1,7 @@ import qs.components import qs.config -import qs.constants import qs.services import qs.utils -import qs.widgets import QtQuick import QtQuick.Layouts @@ -12,13 +10,10 @@ StyledLabel { Ref { service: NetworkService } - StyledText { + LucideIcon { id: icon - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.network.iconSize - font.bold: true - text: Icons.wifiOff + text: Styling.lucide.icons.wifiOff states: [ State { @@ -26,7 +21,7 @@ StyledLabel { when: NetworkService.active?.strength > 50 PropertyChanges { icon { - text: Icons.wifi + text: Styling.lucide.icons.wifi } } }, @@ -35,7 +30,7 @@ StyledLabel { when: NetworkService.active?.strength > 25 PropertyChanges { icon { - text: Icons.wifiHigh + text: Styling.lucide.icons.wifiHigh } } }, @@ -44,7 +39,7 @@ StyledLabel { when: NetworkService.active?.strength > 0 PropertyChanges { icon { - text: Icons.wifiLow + text: Styling.lucide.icons.wifiLow } } } diff --git a/modules/bar/components/Power.qml b/modules/bar/components/Power.qml index a42a23c..2dae2d1 100644 --- a/modules/bar/components/Power.qml +++ b/modules/bar/components/Power.qml @@ -1,6 +1,5 @@ import qs.components import qs.config -import qs.constants import QtQuick import QtQuick.Layouts import Quickshell.Services.UPower @@ -26,18 +25,18 @@ StyledButton { font.pixelSize: 16 text: { if (root.laptopBattery?.state == UPowerDeviceState.Charging) { - return Icons.batteryCharging; + return Styling.lucide.icons.batteryCharging; } if (root.isCritical) { - return Icons.batteryWarning; + return Styling.lucide.icons.batteryWarning; } if (root.laptopBattery?.percentage < 0.33) { - return Icons.batteryLow; + return Styling.lucide.icons.batteryLow; } if (root.laptopBattery?.percentage < 0.66) { - return Icons.batteryMedium; + return Styling.lucide.icons.batteryMedium; } - return Icons.batteryFull; + return Styling.lucide.icons.batteryFull; } } diff --git a/modules/bar/components/Pywal.qml b/modules/bar/components/Pywal.qml index d83c508..5a38593 100644 --- a/modules/bar/components/Pywal.qml +++ b/modules/bar/components/Pywal.qml @@ -1,12 +1,12 @@ import qs.components -import qs.constants +import qs.config import QtQuick import Quickshell.Io StyledIconButton { id: clickable - text: Icons.brickWall + text: Styling.lucide.icons.brickWall onClicked: { process.running = true; diff --git a/modules/bar/components/Storage.qml b/modules/bar/components/Storage.qml index 56fbeb3..a7d189a 100644 --- a/modules/bar/components/Storage.qml +++ b/modules/bar/components/Storage.qml @@ -1,9 +1,7 @@ import qs.components import qs.config -import qs.constants import qs.services import qs.utils -import qs.widgets import QtQuick import QtQuick.Layouts @@ -12,13 +10,8 @@ StyledLabel { Ref { service: SystemInfo } - StyledText { - id: icon - - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.storage.iconSize - font.bold: true - text: Icons.hardDrive + LucideIcon { + text: Styling.lucide.icons.hardDrive } StyledText { diff --git a/modules/bar/components/bluetooth/AvailableDevice.qml b/modules/bar/components/bluetooth/AvailableDevice.qml index e868b8e..c941649 100644 --- a/modules/bar/components/bluetooth/AvailableDevice.qml +++ b/modules/bar/components/bluetooth/AvailableDevice.qml @@ -1,7 +1,6 @@ pragma ComponentBehavior: Bound import qs.components -import qs.widgets import QtQuick import QtQuick.Layouts import Quickshell diff --git a/modules/bar/components/bluetooth/Bluetooth.qml b/modules/bar/components/bluetooth/Bluetooth.qml index c12c93b..e30639d 100644 --- a/modules/bar/components/bluetooth/Bluetooth.qml +++ b/modules/bar/components/bluetooth/Bluetooth.qml @@ -1,10 +1,10 @@ import qs.components -import qs.constants +import qs.config StyledIconButton { id: root - text: Icons.bluetooth + text: Styling.lucide.icons.bluetooth onClicked: popup.toggle() diff --git a/modules/bar/components/bluetooth/ConnectedDevice.qml b/modules/bar/components/bluetooth/ConnectedDevice.qml index ce72790..ebdb49e 100644 --- a/modules/bar/components/bluetooth/ConnectedDevice.qml +++ b/modules/bar/components/bluetooth/ConnectedDevice.qml @@ -2,8 +2,6 @@ pragma ComponentBehavior: Bound import qs.components import qs.config -import qs.constants -import qs.widgets import QtQuick import QtQuick.Layouts import Quickshell @@ -34,12 +32,9 @@ StyledLabel { Loader { active: root.modelData.batteryAvailable sourceComponent: RowLayout { - StyledText { + LucideIcon { id: icon - font.family: Theme.lucide.font.family - font.pixelSize: Dimensions.cpu.iconSize - font.bold: true - text: Icons.batteryFull + text: Styling.lucide.icons.batteryFull states: [ State { name: "full" @@ -50,7 +45,7 @@ StyledLabel { when: root.modelData.battery > 0.33 PropertyChanges { icon { - text: Icons.batteryFull + text: Styling.lucide.icons.batteryFull } } }, @@ -59,7 +54,7 @@ StyledLabel { when: root.modelData.battery > 0.10 PropertyChanges { icon { - text: Icons.batteryFull + text: Styling.lucide.icons.batteryFull } } }, @@ -68,7 +63,7 @@ StyledLabel { when: root.modelData.battery > 0.10 PropertyChanges { icon { - text: Icons.batteryWarning + text: Styling.lucide.icons.batteryWarning color: Theme.palette.error } } diff --git a/modules/bar/components/hyprland/Workspace.qml b/modules/bar/components/hyprland/Workspace.qml index 07acca9..f342917 100644 --- a/modules/bar/components/hyprland/Workspace.qml +++ b/modules/bar/components/hyprland/Workspace.qml @@ -1,6 +1,5 @@ import qs.components import qs.config -import qs.constants import QtQuick import Quickshell.Hyprland @@ -9,7 +8,7 @@ StyledIconButton { required property HyprlandWorkspace workspace - text: Icons.triangle + text: Styling.lucide.icons.triangle font.bold: true font.pixelSize: 17 padding: 8 @@ -32,7 +31,7 @@ StyledIconButton { when: root.workspace.active PropertyChanges { root { - text: Icons.triangleDashed + text: Styling.lucide.icons.triangleDashed rotation: 180 color: root.hovered ? Theme.palette.basecontent : Theme.palette.primary } diff --git a/modules/bar/components/notifications/Notifications.qml b/modules/bar/components/notifications/Notifications.qml index a33b673..a0080c2 100644 --- a/modules/bar/components/notifications/Notifications.qml +++ b/modules/bar/components/notifications/Notifications.qml @@ -1,5 +1,5 @@ import qs.components -import qs.constants +import qs.config import qs.services import QtQuick @@ -10,13 +10,13 @@ StyledIconButton { menu.toggle(); } - text: Notifications.hasNotifications ? Icons.bell : Icons.bellRing + text: Notifications.hasNotifications ? Styling.lucide.icons.bell : Styling.lucide.icons.bellRing states: State { when: Notifications.hasNotifications PropertyChanges { root { - text: Icons.bellRing + text: Styling.lucide.icons.bellRing } } } diff --git a/modules/launcher/Launcher.qml b/modules/launcher/Launcher.qml index b64322c..e976626 100644 --- a/modules/launcher/Launcher.qml +++ b/modules/launcher/Launcher.qml @@ -3,7 +3,6 @@ pragma ComponentBehavior: Bound import "services" import qs.config import qs.components -import qs.constants import qs.services import Quickshell.Hyprland import Quickshell.Wayland @@ -54,7 +53,7 @@ StyledWindow { LucideIcon { id: icon Layout.leftMargin: 8 - text: Icons.search + text: Styling.lucide.icons.search } StyledTextField { diff --git a/modules/pomodoro/Pomodoro.qml b/modules/pomodoro/Pomodoro.qml index 249dcda..925d652 100644 --- a/modules/pomodoro/Pomodoro.qml +++ b/modules/pomodoro/Pomodoro.qml @@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound import qs.components import qs.config -import qs.constants import qs.services import qs.widgets import Quickshell.Hyprland @@ -69,7 +68,7 @@ StyledWindow { radius: 9999 focus: root.visible - text: Pomodoro.running ? Icons.square : Icons.play + text: Pomodoro.running ? Styling.lucide.icons.square : Styling.lucide.icons.play font.pixelSize: 48 background: Item {} diff --git a/modules/storybook/Storybook.qml b/modules/storybook/Storybook.qml index 4e60d14..3815c7f 100644 --- a/modules/storybook/Storybook.qml +++ b/modules/storybook/Storybook.qml @@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound import qs.components import qs.config -import qs.constants import qs.services import Quickshell.Hyprland import Quickshell.Wayland @@ -57,7 +56,7 @@ StyledWindow { font.pixelSize: 18 } StyledIconButton { - text: Icons.square + text: Styling.lucide.icons.square } }