From fd839059c09632c26d69a03e88641ff4d4a26cf4 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 25 Dec 2025 12:50:26 -0500 Subject: [PATCH] popout: use mapToItem instead of mapToGlobal for popout positioning fixes #1152 --- quickshell/Common/SettingsData.qml | 26 +++++---- quickshell/Common/Theme.qml | 2 +- .../ControlCenter/ControlCenterPopout.qml | 2 - .../Modules/ControlCenter/utils/state.js | 32 +++++------ quickshell/Modules/DankBar/DankBarContent.qml | 44 +++++++-------- quickshell/Modules/DankBar/DankBarWindow.qml | 18 +++---- .../DankBar/Widgets/ControlCenterButton.qml | 20 +++---- quickshell/Modules/DankBar/Widgets/Media.qml | 4 +- .../Modules/DankBar/Widgets/SystemUpdate.qml | 54 +++++++++++-------- quickshell/Modules/Plugins/BasePill.qml | 2 +- .../Modules/Plugins/PluginComponent.qml | 12 ++--- 11 files changed, 104 insertions(+), 112 deletions(-) diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 4451b2a2..20f102b9 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -576,7 +576,8 @@ Singleton { function updateDesktopWidgetInstance(instanceId, updates) { const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const idx = instances.findIndex(inst => inst.id === instanceId); - if (idx === -1) return; + if (idx === -1) + return; Object.assign(instances[idx], updates); desktopWidgetInstances = instances; saveSettings(); @@ -585,7 +586,8 @@ Singleton { function updateDesktopWidgetInstanceConfig(instanceId, configUpdates) { const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const idx = instances.findIndex(inst => inst.id === instanceId); - if (idx === -1) return; + if (idx === -1) + return; instances[idx].config = Object.assign({}, instances[idx].config || {}, configUpdates); desktopWidgetInstances = instances; saveSettings(); @@ -594,13 +596,11 @@ Singleton { function updateDesktopWidgetInstancePosition(instanceId, screenKey, positionUpdates) { const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const idx = instances.findIndex(inst => inst.id === instanceId); - if (idx === -1) return; - if (!instances[idx].positions) instances[idx].positions = {}; - instances[idx].positions[screenKey] = Object.assign( - {}, - instances[idx].positions[screenKey] || {}, - positionUpdates - ); + if (idx === -1) + return; + if (!instances[idx].positions) + instances[idx].positions = {}; + instances[idx].positions[screenKey] = Object.assign({}, instances[idx].positions[screenKey] || {}, positionUpdates); desktopWidgetInstances = instances; saveSettings(); } @@ -909,11 +909,9 @@ Singleton { return barHeight + spacing + bottomGap - gothOffset + Theme.popupDistance; } - function getPopupTriggerPosition(globalPos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) { - const screenX = screen ? screen.x : 0; - const screenY = screen ? screen.y : 0; - const relativeX = globalPos.x - screenX; - const relativeY = globalPos.y - screenY; + function getPopupTriggerPosition(pos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) { + const relativeX = pos.x; + const relativeY = pos.y; const defaultBar = barConfigs[0] || getBarConfig("default"); const spacing = barSpacing !== undefined ? barSpacing : (defaultBar?.spacing ?? 4); const position = barPosition !== undefined ? barPosition : (defaultBar?.position ?? SettingsData.Position.Top); diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index f8e56d1e..55bfdbcf 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -258,7 +258,7 @@ Singleton { property color outlineVariant: currentThemeData.outlineVariant || Qt.rgba(outline.r, outline.g, outline.b, 0.6) property color surfaceContainer: currentThemeData.surfaceContainer property color surfaceContainerHigh: currentThemeData.surfaceContainerHigh - property color surfaceContainerHighest: currentThemeData.surfaceContainerHighest + property color surfaceContainerHighest: currentThemeData.surfaceContainerHighest || surfaceContainerHigh property color onSurface: surfaceText property color onSurfaceVariant: surfaceVariantText diff --git a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml index 3cf45352..6bb5d83a 100644 --- a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml +++ b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml @@ -57,8 +57,6 @@ DankPopout { const contentHeight = contentLoader.item && contentLoader.item.implicitHeight > 0 ? contentLoader.item.implicitHeight + 20 : 400; return Math.min(maxHeight, contentHeight); } - triggerX: 0 - triggerY: 0 triggerWidth: 80 positioning: "" screen: triggerScreen diff --git a/quickshell/Modules/ControlCenter/utils/state.js b/quickshell/Modules/ControlCenter/utils/state.js index 393ca296..a2d59a6b 100644 --- a/quickshell/Modules/ControlCenter/utils/state.js +++ b/quickshell/Modules/ControlCenter/utils/state.js @@ -1,25 +1,17 @@ -function setTriggerPosition(root, x, y, width, section, screen) { - root.triggerX = x - root.triggerY = y - root.triggerWidth = width - root.triggerSection = section - root.triggerScreen = screen -} - function openWithSection(root, section) { - if (root.shouldBeVisible) { - root.close() - } else { - root.expandedSection = section - root.open() - } + if (root.shouldBeVisible) { + root.close(); + } else { + root.expandedSection = section; + root.open(); + } } function toggleSection(root, section) { - if (root.expandedSection === section) { - root.expandedSection = "" - root.expandedWidgetIndex = -1 - } else { - root.expandedSection = section - } + if (root.expandedSection === section) { + root.expandedSection = ""; + root.expandedWidgetIndex = -1; + } else { + root.expandedSection = section; + } } diff --git a/quickshell/Modules/DankBar/DankBarContent.qml b/quickshell/Modules/DankBar/DankBarContent.qml index 8bb98ef0..7fee50c7 100644 --- a/quickshell/Modules/DankBar/DankBarContent.qml +++ b/quickshell/Modules/DankBar/DankBarContent.qml @@ -581,7 +581,7 @@ Item { appDrawerLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (appDrawerLoader.item && appDrawerLoader.item.setTriggerPosition) { - const globalPos = launcherButton.visualContent.mapToGlobal(0, 0); + const globalPos = launcherButton.visualContent.mapToItem(null, 0, 0); const currentScreen = barWindow.screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barWindow.effectiveBarThickness, launcherButton.visualWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); appDrawerLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, launcherButton.section, currentScreen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -676,20 +676,20 @@ Item { if (centerSection) { if (barWindow.isVertical) { const centerY = centerSection.height / 2; - const centerGlobalPos = centerSection.mapToGlobal(0, centerY); + const centerGlobalPos = centerSection.mapToItem(null, 0, centerY); triggerPos = centerGlobalPos; triggerWidth = centerSection.height; } else { - const centerGlobalPos = centerSection.mapToGlobal(0, 0); + const centerGlobalPos = centerSection.mapToItem(null, 0, 0); triggerPos = centerGlobalPos; triggerWidth = centerSection.width; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); @@ -732,20 +732,20 @@ Item { if (centerSection) { if (barWindow.isVertical) { const centerY = centerSection.height / 2; - const centerGlobalPos = centerSection.mapToGlobal(0, centerY); + const centerGlobalPos = centerSection.mapToItem(null, 0, centerY); triggerPos = centerGlobalPos; triggerWidth = centerSection.height; } else { - const centerGlobalPos = centerSection.mapToGlobal(0, 0); + const centerGlobalPos = centerSection.mapToItem(null, 0, 0); triggerPos = centerGlobalPos; triggerWidth = centerSection.width; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); @@ -790,21 +790,21 @@ Item { // For vertical bars, use center Y of section; for horizontal, use left edge if (barWindow.isVertical) { const centerY = centerSection.height / 2; - const centerGlobalPos = centerSection.mapToGlobal(0, centerY); + const centerGlobalPos = centerSection.mapToItem(null, 0, centerY); triggerPos = centerGlobalPos; triggerWidth = centerSection.height; } else { // For horizontal bars, use left edge (DankPopout will center it) - const centerGlobalPos = centerSection.mapToGlobal(0, 0); + const centerGlobalPos = centerSection.mapToItem(null, 0, 0); triggerPos = centerGlobalPos; triggerWidth = centerSection.width; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } } else { - triggerPos = visualContent.mapToGlobal(0, 0); + triggerPos = visualContent.mapToItem(null, 0, 0); triggerWidth = visualWidth; } const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); @@ -871,7 +871,7 @@ Item { processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (processListPopoutLoader.item.setTriggerPosition) { - const globalPos = cpuWidget.mapToGlobal(0, 0); + const globalPos = cpuWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -907,7 +907,7 @@ Item { processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (processListPopoutLoader.item.setTriggerPosition) { - const globalPos = ramWidget.mapToGlobal(0, 0); + const globalPos = ramWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, ramWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -957,7 +957,7 @@ Item { processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (processListPopoutLoader.item.setTriggerPosition) { - const globalPos = cpuTempWidget.mapToGlobal(0, 0); + const globalPos = cpuTempWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -993,7 +993,7 @@ Item { processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (processListPopoutLoader.item.setTriggerPosition) { - const globalPos = gpuTempWidget.mapToGlobal(0, 0); + const globalPos = gpuTempWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, gpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -1036,7 +1036,7 @@ Item { notificationCenterLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (notificationCenterLoader.item.setTriggerPosition) { - const globalPos = notificationButton.mapToGlobal(0, 0); + const globalPos = notificationButton.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, notificationButton.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; notificationCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -1074,7 +1074,7 @@ Item { batteryPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); } if (batteryPopoutLoader.item.setTriggerPosition) { - const globalPos = batteryWidget.mapToGlobal(0, 0); + const globalPos = batteryWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, batteryWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; batteryPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -1107,7 +1107,7 @@ Item { const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1)); if (layoutPopoutLoader.item.setTriggerPosition) { - const globalPos = layoutWidget.mapToGlobal(0, 0); + const globalPos = layoutWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, layoutWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "center"; layoutPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -1147,7 +1147,7 @@ Item { } if (vpnPopoutLoader.item.setTriggerPosition) { - const globalPos = vpnWidget.mapToGlobal(0, 0); + const globalPos = vpnWidget.mapToItem(null, 0, 0); const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, vpnWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const widgetSection = topBarContent.getWidgetSection(parent) || "right"; vpnPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig); @@ -1193,7 +1193,7 @@ Item { } controlCenterLoader.item.triggerScreen = barWindow.screen; if (controlCenterLoader.item.setTriggerPosition) { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); // Use topBarContent.barConfig directly const effectiveBarConfig = topBarContent.barConfig; // Calculate barPosition from axis.edge like Battery widget does diff --git a/quickshell/Modules/DankBar/DankBarWindow.qml b/quickshell/Modules/DankBar/DankBarWindow.qml index a8126f66..30bfc814 100644 --- a/quickshell/Modules/DankBar/DankBarWindow.qml +++ b/quickshell/Modules/DankBar/DankBarWindow.qml @@ -27,10 +27,9 @@ PanelWindow { } if (controlCenterButtonRef && controlCenterLoader.item.setTriggerPosition) { - const globalPos = controlCenterButtonRef.mapToGlobal(0, 0); - // Calculate barPosition from axis.edge + const screenPos = controlCenterButtonRef.mapToItem(null, 0, 0); const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); - const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, controlCenterButtonRef.width, barConfig?.spacing ?? 4, barPosition, barConfig); + const pos = SettingsData.getPopupTriggerPosition(screenPos, barWindow.screen, barWindow.effectiveBarThickness, controlCenterButtonRef.width, barConfig?.spacing ?? 4, barPosition, barConfig); const section = controlCenterButtonRef.section || "right"; controlCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig); } else { @@ -54,29 +53,24 @@ PanelWindow { const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); const section = clockButtonRef.section || "center"; - // For center section widgets, use center section bounds for DankDash centering let triggerPos, triggerWidth; if (section === "center") { const centerSection = barWindow.isVertical ? (barWindow.axis?.edge === "left" ? topBarContent.vCenterSection : topBarContent.vCenterSection) : topBarContent.hCenterSection; if (centerSection) { - // For vertical bars, use center Y of section; for horizontal, use left edge if (barWindow.isVertical) { const centerY = centerSection.height / 2; - const centerGlobalPos = centerSection.mapToGlobal(0, centerY); - triggerPos = centerGlobalPos; + triggerPos = centerSection.mapToItem(null, 0, centerY); triggerWidth = centerSection.height; } else { - // For horizontal bars, use left edge (DankPopout will center it) - const centerGlobalPos = centerSection.mapToGlobal(0, 0); - triggerPos = centerGlobalPos; + triggerPos = centerSection.mapToItem(null, 0, 0); triggerWidth = centerSection.width; } } else { - triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0); + triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0); triggerWidth = clockButtonRef.visualWidth; } } else { - triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0); + triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0); triggerWidth = clockButtonRef.visualWidth; } diff --git a/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml b/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml index 667d0b81..a768079c 100644 --- a/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml +++ b/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml @@ -264,14 +264,14 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: Theme.widgetIconColor anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent + anchors.top: parent.top anchors.topMargin: 2 } StyledText { id: audioPercentV visible: root.showAudioPercent - text: Math.round(AudioService.sink.audio.volume * 100) + "%" + text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%" font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale) color: Theme.widgetTextColor anchors.horizontalCenter: parent.horizontalCenter @@ -305,14 +305,14 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: root.getMicIconColor() anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent + anchors.top: parent.top anchors.topMargin: 2 } StyledText { id: micPercentV visible: root.showMicPercent - text: Math.round(AudioService.source.audio.volume * 100) + "%" + text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%" font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale) color: Theme.widgetTextColor anchors.horizontalCenter: parent.horizontalCenter @@ -346,7 +346,7 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: Theme.widgetIconColor anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent + anchors.top: parent.top anchors.topMargin: 2 } @@ -442,14 +442,14 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: Theme.widgetIconColor anchors.verticalCenter: parent.verticalCenter - anchors.left: parent + anchors.left: parent.left anchors.leftMargin: 2 } StyledText { id: audioPercent visible: root.showAudioPercent - text: Math.round(AudioService.sink.audio.volume * 100) + "%" + text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%" font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale) color: Theme.widgetTextColor anchors.verticalCenter: parent.verticalCenter @@ -484,14 +484,14 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: root.getMicIconColor() anchors.verticalCenter: parent.verticalCenter - anchors.left: parent + anchors.left: parent.left anchors.leftMargin: 2 } StyledText { id: micPercent visible: root.showMicPercent - text: Math.round(AudioService.source.audio.volume * 100) + "%" + text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%" font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale) color: Theme.widgetTextColor anchors.verticalCenter: parent.verticalCenter @@ -526,7 +526,7 @@ BasePill { size: Theme.barIconSize(root.barThickness, -4) color: Theme.widgetIconColor anchors.verticalCenter: parent.verticalCenter - anchors.left: parent + anchors.left: parent.left anchors.leftMargin: 2 } diff --git a/quickshell/Modules/DankBar/Widgets/Media.qml b/quickshell/Modules/DankBar/Widgets/Media.qml index b3cb5edf..593f6673 100644 --- a/quickshell/Modules/DankBar/Widgets/Media.qml +++ b/quickshell/Modules/DankBar/Widgets/Media.qml @@ -139,7 +139,7 @@ BasePill { cursorShape: Qt.PointingHandCursor onClicked: { if (root.popoutTarget && root.popoutTarget.setTriggerPosition) { - const globalPos = parent.mapToGlobal(0, 0); + const globalPos = parent.mapToItem(null, 0, 0); const currentScreen = root.parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width); root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen); @@ -294,7 +294,7 @@ BasePill { cursorShape: Qt.PointingHandCursor onPressed: { if (root.popoutTarget && root.popoutTarget.setTriggerPosition) { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); const currentScreen = root.parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width); root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen); diff --git a/quickshell/Modules/DankBar/Widgets/SystemUpdate.qml b/quickshell/Modules/DankBar/Widgets/SystemUpdate.qml index 20fa512b..504d4232 100644 --- a/quickshell/Modules/DankBar/Widgets/SystemUpdate.qml +++ b/quickshell/Modules/DankBar/Widgets/SystemUpdate.qml @@ -12,7 +12,7 @@ BasePill { readonly property bool isChecking: SystemUpdateService.isChecking readonly property real horizontalPadding: (barConfig?.noBackground ?? false) ? 2 : Theme.spacingS - width : (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2) + width: (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2) Ref { service: SystemUpdateService @@ -28,16 +28,21 @@ BasePill { anchors.centerIn: parent visible: root.isVerticalOrientation name: { - if (root.isChecking) return "refresh" - if (SystemUpdateService.hasError) return "error" - if (root.hasUpdates) return "system_update_alt" - return "check_circle" + if (root.isChecking) + return "refresh"; + if (SystemUpdateService.hasError) + return "error"; + if (root.hasUpdates) + return "system_update_alt"; + return "check_circle"; } size: Theme.barIconSize(root.barThickness, -4) color: { - if (SystemUpdateService.hasError) return Theme.error - if (root.hasUpdates) return Theme.primary - return root.isActive ? Theme.primary : Theme.surfaceText + if (SystemUpdateService.hasError) + return Theme.error; + if (root.hasUpdates) + return Theme.primary; + return root.isActive ? Theme.primary : Theme.surfaceText; } RotationAnimation { @@ -52,7 +57,7 @@ BasePill { onRunningChanged: { if (!running) { - statusIcon.rotation = 0 + statusIcon.rotation = 0; } } } @@ -80,16 +85,21 @@ BasePill { id: statusIconHorizontal anchors.verticalCenter: parent.verticalCenter name: { - if (root.isChecking) return "refresh" - if (SystemUpdateService.hasError) return "error" - if (root.hasUpdates) return "system_update_alt" - return "check_circle" + if (root.isChecking) + return "refresh"; + if (SystemUpdateService.hasError) + return "error"; + if (root.hasUpdates) + return "system_update_alt"; + return "check_circle"; } size: Theme.barIconSize(root.barThickness, -4) color: { - if (SystemUpdateService.hasError) return Theme.error - if (root.hasUpdates) return Theme.primary - return root.isActive ? Theme.primary : Theme.surfaceText + if (SystemUpdateService.hasError) + return Theme.error; + if (root.hasUpdates) + return Theme.primary; + return root.isActive ? Theme.primary : Theme.surfaceText; } RotationAnimation { @@ -104,7 +114,7 @@ BasePill { onRunningChanged: { if (!running) { - statusIconHorizontal.rotation = 0 + statusIconHorizontal.rotation = 0; } } } @@ -128,12 +138,12 @@ BasePill { cursorShape: Qt.PointingHandCursor onPressed: { if (popoutTarget && popoutTarget.setTriggerPosition) { - const globalPos = root.visualContent.mapToGlobal(0, 0) - const currentScreen = parentScreen || Screen - const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth) - popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen) + const globalPos = root.visualContent.mapToItem(null, 0, 0); + const currentScreen = parentScreen || Screen; + const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth); + popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen); } - root.clicked() + root.clicked(); } } } diff --git a/quickshell/Modules/Plugins/BasePill.qml b/quickshell/Modules/Plugins/BasePill.qml index 4278a570..9f5d105e 100644 --- a/quickshell/Modules/Plugins/BasePill.qml +++ b/quickshell/Modules/Plugins/BasePill.qml @@ -137,7 +137,7 @@ Item { } if (popoutTarget.setTriggerPosition) { - const globalPos = root.visualContent.mapToGlobal(0, 0); + const globalPos = root.visualContent.mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const barPosition = root.axis?.edge === "left" ? 2 : (root.axis?.edge === "right" ? 3 : (root.axis?.edge === "top" ? 0 : 1)); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth, root.barSpacing, barPosition, root.barConfig); diff --git a/quickshell/Modules/Plugins/PluginComponent.qml b/quickshell/Modules/Plugins/PluginComponent.qml index 3fe3ba19..3b4f2e17 100644 --- a/quickshell/Modules/Plugins/PluginComponent.qml +++ b/quickshell/Modules/Plugins/PluginComponent.qml @@ -119,7 +119,7 @@ Item { if (pillClickAction.length === 0) { pillClickAction(); } else { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); @@ -133,7 +133,7 @@ Item { if (pillRightClickAction.length === 0) { pillRightClickAction(); } else { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen); @@ -160,7 +160,7 @@ Item { if (pillClickAction.length === 0) { pillClickAction(); } else { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); @@ -174,7 +174,7 @@ Item { if (pillRightClickAction.length === 0) { pillRightClickAction(); } else { - const globalPos = mapToGlobal(0, 0); + const globalPos = mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen); @@ -196,7 +196,7 @@ Item { return; } const pill = isVertical ? verticalPill : horizontalPill; - const globalPos = pill.mapToGlobal(0, 0); + const globalPos = pill.mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.width); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); @@ -206,7 +206,7 @@ Item { return; const pill = isVertical ? verticalPill : horizontalPill; - const globalPos = pill.visualContent.mapToGlobal(0, 0); + const globalPos = pill.visualContent.mapToItem(null, 0, 0); const currentScreen = parentScreen || Screen; const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.visualWidth, barSpacing, barPosition, barConfig);