From 5c5e4140722307173218e31bec90e35a7efa26d4 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Thu, 9 Oct 2025 09:43:40 -0400 Subject: [PATCH] Auto formatting --- Modules/Bar/Widgets/Tray.qml | 110 +++++++++++++++--------------- Modules/LockScreen/LockScreen.qml | 12 ---- 2 files changed, 54 insertions(+), 68 deletions(-) diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index d3dc5dd7..30a3f7b9 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -79,71 +79,69 @@ Rectangle { } opacity: status === Image.Ready ? 1 : 0 - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onClicked: mouse => { - if (!modelData) { - return - } - - if (mouse.button === Qt.LeftButton) { - // Close any open menu first - trayPanel.close() - - if (!modelData.onlyMenu) { - modelData.activate() - } - } else if (mouse.button === Qt.MiddleButton) { - // Close any open menu first - trayPanel.close() - - modelData.secondaryActivate && modelData.secondaryActivate() - } else if (mouse.button === Qt.RightButton) { - TooltipService.hideImmediately() - - // Close the menu if it was visible - if (trayPanel && trayPanel.visible) { - trayPanel.close() + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + onClicked: mouse => { + if (!modelData) { return } - if (modelData.hasMenu && modelData.menu && trayMenu.item) { - trayPanel.open() + if (mouse.button === Qt.LeftButton) { + // Close any open menu first + trayPanel.close() - // Position menu based on bar position - let menuX, menuY - if (barPosition === "left") { - // For left bar: position menu to the right of the bar - menuX = width + Style.marginM * scaling - menuY = 0 - } else if (barPosition === "right") { - // For right bar: position menu to the left of the bar - menuX = -trayMenu.item.width - Style.marginM * scaling - menuY = 0 - } else { - // For horizontal bars: center horizontally and position below - menuX = (width / 2) - (trayMenu.item.width / 2) - menuY = Math.round(Style.barHeight * scaling) + if (!modelData.onlyMenu) { + modelData.activate() + } + } else if (mouse.button === Qt.MiddleButton) { + // Close any open menu first + trayPanel.close() + + modelData.secondaryActivate && modelData.secondaryActivate() + } else if (mouse.button === Qt.RightButton) { + TooltipService.hideImmediately() + + // Close the menu if it was visible + if (trayPanel && trayPanel.visible) { + trayPanel.close() + return + } + + if (modelData.hasMenu && modelData.menu && trayMenu.item) { + trayPanel.open() + + // Position menu based on bar position + let menuX, menuY + if (barPosition === "left") { + // For left bar: position menu to the right of the bar + menuX = width + Style.marginM * scaling + menuY = 0 + } else if (barPosition === "right") { + // For right bar: position menu to the left of the bar + menuX = -trayMenu.item.width - Style.marginM * scaling + menuY = 0 + } else { + // For horizontal bars: center horizontally and position below + menuX = (width / 2) - (trayMenu.item.width / 2) + menuY = Math.round(Style.barHeight * scaling) + } + trayMenu.item.menu = modelData.menu + trayMenu.item.showAt(parent, menuX, menuY) + } else { + Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set") } - trayMenu.item.menu = modelData.menu - trayMenu.item.showAt(parent, menuX, menuY) - } else { - Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set") } } - } - onEntered: { - trayPanel.close() - TooltipService.show(Screen, trayIcon, modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item", BarService.getTooltipDirection()) + onEntered: { + trayPanel.close() + TooltipService.show(Screen, trayIcon, modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item", BarService.getTooltipDirection()) + } + onExited: TooltipService.hide() } - onExited: TooltipService.hide() } - } - - } } } diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 38ef38ff..f1849705 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -413,12 +413,6 @@ Loader { color: Color.mOnSurface horizontalAlignment: Text.AlignHCenter Layout.alignment: Qt.AlignHCenter - - // Connections { - // target: Time - // function onDateChanged() {// Trigger text update - // } - // } } NText { @@ -428,12 +422,6 @@ Loader { color: Color.mOnSurfaceVariant horizontalAlignment: Text.AlignHCenter Layout.alignment: Qt.AlignHCenter - - // Connections { - // target: Time - // function onDateChanged() {// Trigger text update - // } - // } } } }