diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 14:23:25 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 14:23:25 +0200 |
| commit | 25c82713f500c9c254948e05aa278ad7d125d751 (patch) | |
| tree | a7dbfcd3590293228c0c83d0b3e5b7fec6466b93 | |
| parent | f7e0b3e5c5730c2b9b88f6075dc770829afabcd2 (diff) | |
| download | sddm-theme-udt-25c82713f500c9c254948e05aa278ad7d125d751.tar.gz sddm-theme-udt-25c82713f500c9c254948e05aa278ad7d125d751.zip | |
feat: draw the power bar from the resolved icon theme paths
| -rw-r--r-- | theme/components/PowerBar.qml | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/theme/components/PowerBar.qml b/theme/components/PowerBar.qml index 9db65e7..1ce3e76 100644 --- a/theme/components/PowerBar.qml +++ b/theme/components/PowerBar.qml @@ -1,8 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only // Copyright (C) 2026 Danilo M. <danix@danix.xyz> // -// Shutdown, restart, sleep and hibernate. Each button is disabled when SDDM -// reports the action is unavailable. +// Shutdown, restart, sleep and hibernate. Each icon is the path udt-accent +// resolved from the selected icon theme, falling back to the bundled line art +// when the key is empty or the file fails to load. Each button is disabled when +// SDDM reports the action is unavailable. import QtQuick import QtQuick.Controls.Basic @@ -10,25 +12,29 @@ import QtQuick.Effects Row { id: bar - spacing: 8 + spacing: 12 readonly property var actions: [ - { icon: "../icons/power.svg", label: "Shut down", enabled: sddm.canPowerOff, run: function() { sddm.powerOff() } }, - { icon: "../icons/reboot.svg", label: "Restart", enabled: sddm.canReboot, run: function() { sddm.reboot() } }, - { icon: "../icons/suspend.svg", label: "Sleep", enabled: sddm.canSuspend, run: function() { sddm.suspend() } }, - { icon: "../icons/hibernate.svg", label: "Hibernate", enabled: sddm.canHibernate, run: function() { sddm.hibernate() } } + { icon: config.stringValue("powerIcon"), fallback: "../icons/power.svg", + label: "Shut down", enabled: sddm.canPowerOff, run: function() { sddm.powerOff() } }, + { icon: config.stringValue("rebootIcon"), fallback: "../icons/reboot.svg", + label: "Restart", enabled: sddm.canReboot, run: function() { sddm.reboot() } }, + { icon: config.stringValue("suspendIcon"), fallback: "../icons/suspend.svg", + label: "Sleep", enabled: sddm.canSuspend, run: function() { sddm.suspend() } }, + { icon: config.stringValue("hibernateIcon"), fallback: "../icons/hibernate.svg", + label: "Hibernate", enabled: sddm.canHibernate, run: function() { sddm.hibernate() } } ] Repeater { model: bar.actions delegate: Item { - width: 44 - height: 44 + width: 56 + height: 56 opacity: modelData.enabled ? 1 : 0.35 Rectangle { anchors.fill: parent - radius: 8 + radius: 10 color: config.stringValue("surface0") opacity: mouse.containsMouse && modelData.enabled ? 1 : 0 } @@ -36,10 +42,16 @@ Row { Image { id: icon anchors.centerIn: parent - width: 22 - height: 22 - source: modelData.icon + width: 34 + height: 34 + sourceSize.width: width + sourceSize.height: height + source: modelData.icon !== "" ? modelData.icon : modelData.fallback visible: false + onStatusChanged: { + if (status === Image.Error && source !== modelData.fallback) + source = modelData.fallback + } } MultiEffect { |
