From 5b81104ffa22465e8f97a4d625e1a151c5d50c2f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 9 Sep 2025 21:02:24 +1000 Subject: bar/tray: add icon subs Usage: array of { id, image | icon } --- utils/Icons.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'utils') diff --git a/utils/Icons.qml b/utils/Icons.qml index 76eef43..45c1537 100644 --- a/utils/Icons.qml +++ b/utils/Icons.qml @@ -1,5 +1,6 @@ pragma Singleton +import qs.config import Quickshell import Quickshell.Services.Notifications @@ -205,4 +206,16 @@ Singleton { return "monitor_heart"; return name[0].toUpperCase(); } + + function getTrayIcon(id: string, icon: string): string { + for (const sub of Config.bar.tray.iconSubs) + if (sub.id === id) + return sub.image ? Qt.resolvedUrl(sub.image) : Quickshell.iconPath(sub.icon); + + if (icon.includes("?path=")) { + const [name, path] = icon.split("?path="); + icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`); + } + return icon; + } } -- cgit v1.2.3-freya