From 81b8ff31d845d31bc8116c6a3cb3702c8a85be70 Mon Sep 17 00:00:00 2001 From: Kaj Date: Sat, 26 Jul 2025 06:16:52 +0200 Subject: config: enable/disable status icons (#243) * Adds ability to disable/enable status icons Improves the hover calculations so that it's not hardcoded. This should make it easier to add/remove status icons. Also adds an optional audio status icon. * status: move config to barconfig * fixes * fix merge * loader icons * fix audio popout --------- Co-authored-by: Kaj Giesbers Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> --- modules/bar/Bar.qml | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'modules/bar/Bar.qml') diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 9c84793..8d6f2bb 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -23,14 +23,24 @@ Item { const th = tray.implicitHeight; const trayItems = tray.items; - const n = statusIconsInner.network; - const ny = statusIcons.y + statusIconsInner.y + n.y - spacing / 2; - - const bls = statusIcons.y + statusIconsInner.y + statusIconsInner.bs - spacing / 2; - const ble = statusIcons.y + statusIconsInner.y + statusIconsInner.be + spacing / 2; - - const b = statusIconsInner.battery; - const by = statusIcons.y + statusIconsInner.y + b.y - spacing / 2; + // Check status icons hover areas + let statusIconFound = false; + for (const area of statusIconsInner.hoverAreas) { + if (!area.enabled) + continue; + + const item = area.item; + const itemY = statusIcons.y + statusIconsInner.y + item.y - spacing / 2; + const itemHeight = item.implicitHeight + spacing; + + if (y >= itemY && y <= itemY + itemHeight) { + popouts.currentName = area.name; + popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + item.y + item.implicitHeight / 2); + popouts.hasCurrent = true; + statusIconFound = true; + break; + } + } if (y >= awy && y <= awy + aw.implicitHeight) { popouts.currentName = "activewindow"; @@ -43,19 +53,7 @@ Item { popouts.currentName = `traymenu${index}`; popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2); popouts.hasCurrent = true; - } else if (y >= ny && y <= ny + n.implicitHeight + spacing) { - popouts.currentName = "network"; - popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2); - popouts.hasCurrent = true; - } else if (y >= bls && y <= ble) { - popouts.currentName = "bluetooth"; - popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2); - popouts.hasCurrent = true; - } else if (y >= by && y <= by + b.implicitHeight + spacing) { - popouts.currentName = "battery"; - popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2); - popouts.hasCurrent = true; - } else { + } else if (!statusIconFound) { popouts.hasCurrent = false; } } -- cgit v1.2.3-freya