1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

popout: use mapToItem instead of mapToGlobal for popout positioning

fixes #1152
This commit is contained in:
bbedward
2025-12-25 12:50:26 -05:00
parent ec6db7962a
commit fd839059c0
11 changed files with 104 additions and 112 deletions

View File

@@ -576,7 +576,8 @@ Singleton {
function updateDesktopWidgetInstance(instanceId, updates) { function updateDesktopWidgetInstance(instanceId, updates) {
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
const idx = instances.findIndex(inst => inst.id === instanceId); const idx = instances.findIndex(inst => inst.id === instanceId);
if (idx === -1) return; if (idx === -1)
return;
Object.assign(instances[idx], updates); Object.assign(instances[idx], updates);
desktopWidgetInstances = instances; desktopWidgetInstances = instances;
saveSettings(); saveSettings();
@@ -585,7 +586,8 @@ Singleton {
function updateDesktopWidgetInstanceConfig(instanceId, configUpdates) { function updateDesktopWidgetInstanceConfig(instanceId, configUpdates) {
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
const idx = instances.findIndex(inst => inst.id === instanceId); 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); instances[idx].config = Object.assign({}, instances[idx].config || {}, configUpdates);
desktopWidgetInstances = instances; desktopWidgetInstances = instances;
saveSettings(); saveSettings();
@@ -594,13 +596,11 @@ Singleton {
function updateDesktopWidgetInstancePosition(instanceId, screenKey, positionUpdates) { function updateDesktopWidgetInstancePosition(instanceId, screenKey, positionUpdates) {
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || [])); const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
const idx = instances.findIndex(inst => inst.id === instanceId); const idx = instances.findIndex(inst => inst.id === instanceId);
if (idx === -1) return; if (idx === -1)
if (!instances[idx].positions) instances[idx].positions = {}; return;
instances[idx].positions[screenKey] = Object.assign( if (!instances[idx].positions)
{}, instances[idx].positions = {};
instances[idx].positions[screenKey] || {}, instances[idx].positions[screenKey] = Object.assign({}, instances[idx].positions[screenKey] || {}, positionUpdates);
positionUpdates
);
desktopWidgetInstances = instances; desktopWidgetInstances = instances;
saveSettings(); saveSettings();
} }
@@ -909,11 +909,9 @@ Singleton {
return barHeight + spacing + bottomGap - gothOffset + Theme.popupDistance; return barHeight + spacing + bottomGap - gothOffset + Theme.popupDistance;
} }
function getPopupTriggerPosition(globalPos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) { function getPopupTriggerPosition(pos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) {
const screenX = screen ? screen.x : 0; const relativeX = pos.x;
const screenY = screen ? screen.y : 0; const relativeY = pos.y;
const relativeX = globalPos.x - screenX;
const relativeY = globalPos.y - screenY;
const defaultBar = barConfigs[0] || getBarConfig("default"); const defaultBar = barConfigs[0] || getBarConfig("default");
const spacing = barSpacing !== undefined ? barSpacing : (defaultBar?.spacing ?? 4); const spacing = barSpacing !== undefined ? barSpacing : (defaultBar?.spacing ?? 4);
const position = barPosition !== undefined ? barPosition : (defaultBar?.position ?? SettingsData.Position.Top); const position = barPosition !== undefined ? barPosition : (defaultBar?.position ?? SettingsData.Position.Top);

View File

@@ -258,7 +258,7 @@ Singleton {
property color outlineVariant: currentThemeData.outlineVariant || Qt.rgba(outline.r, outline.g, outline.b, 0.6) property color outlineVariant: currentThemeData.outlineVariant || Qt.rgba(outline.r, outline.g, outline.b, 0.6)
property color surfaceContainer: currentThemeData.surfaceContainer property color surfaceContainer: currentThemeData.surfaceContainer
property color surfaceContainerHigh: currentThemeData.surfaceContainerHigh property color surfaceContainerHigh: currentThemeData.surfaceContainerHigh
property color surfaceContainerHighest: currentThemeData.surfaceContainerHighest property color surfaceContainerHighest: currentThemeData.surfaceContainerHighest || surfaceContainerHigh
property color onSurface: surfaceText property color onSurface: surfaceText
property color onSurfaceVariant: surfaceVariantText property color onSurfaceVariant: surfaceVariantText

View File

@@ -57,8 +57,6 @@ DankPopout {
const contentHeight = contentLoader.item && contentLoader.item.implicitHeight > 0 ? contentLoader.item.implicitHeight + 20 : 400; const contentHeight = contentLoader.item && contentLoader.item.implicitHeight > 0 ? contentLoader.item.implicitHeight + 20 : 400;
return Math.min(maxHeight, contentHeight); return Math.min(maxHeight, contentHeight);
} }
triggerX: 0
triggerY: 0
triggerWidth: 80 triggerWidth: 80
positioning: "" positioning: ""
screen: triggerScreen screen: triggerScreen

View File

@@ -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) { function openWithSection(root, section) {
if (root.shouldBeVisible) { if (root.shouldBeVisible) {
root.close() root.close();
} else { } else {
root.expandedSection = section root.expandedSection = section;
root.open() root.open();
} }
} }
function toggleSection(root, section) { function toggleSection(root, section) {
if (root.expandedSection === section) { if (root.expandedSection === section) {
root.expandedSection = "" root.expandedSection = "";
root.expandedWidgetIndex = -1 root.expandedWidgetIndex = -1;
} else { } else {
root.expandedSection = section root.expandedSection = section;
} }
} }

View File

@@ -581,7 +581,7 @@ Item {
appDrawerLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0); appDrawerLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (appDrawerLoader.item && appDrawerLoader.item.setTriggerPosition) { 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 currentScreen = barWindow.screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barWindow.effectiveBarThickness, launcherButton.visualWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); 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); 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 (centerSection) {
if (barWindow.isVertical) { if (barWindow.isVertical) {
const centerY = centerSection.height / 2; const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY); const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos; triggerPos = centerGlobalPos;
triggerWidth = centerSection.height; triggerWidth = centerSection.height;
} else { } else {
const centerGlobalPos = centerSection.mapToGlobal(0, 0); const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
triggerPos = centerGlobalPos; triggerPos = centerGlobalPos;
triggerWidth = centerSection.width; triggerWidth = centerSection.width;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
@@ -732,20 +732,20 @@ Item {
if (centerSection) { if (centerSection) {
if (barWindow.isVertical) { if (barWindow.isVertical) {
const centerY = centerSection.height / 2; const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY); const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos; triggerPos = centerGlobalPos;
triggerWidth = centerSection.height; triggerWidth = centerSection.height;
} else { } else {
const centerGlobalPos = centerSection.mapToGlobal(0, 0); const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
triggerPos = centerGlobalPos; triggerPos = centerGlobalPos;
triggerWidth = centerSection.width; triggerWidth = centerSection.width;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); 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 // For vertical bars, use center Y of section; for horizontal, use left edge
if (barWindow.isVertical) { if (barWindow.isVertical) {
const centerY = centerSection.height / 2; const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY); const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos; triggerPos = centerGlobalPos;
triggerWidth = centerSection.height; triggerWidth = centerSection.height;
} else { } else {
// For horizontal bars, use left edge (DankPopout will center it) // 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; triggerPos = centerGlobalPos;
triggerWidth = centerSection.width; triggerWidth = centerSection.width;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
} else { } else {
triggerPos = visualContent.mapToGlobal(0, 0); triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth; triggerWidth = visualWidth;
} }
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig); 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); processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (processListPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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); processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (processListPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, ramWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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); processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (processListPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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); processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (processListPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, gpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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); notificationCenterLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (notificationCenterLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, notificationButton.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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); batteryPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
} }
if (batteryPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, batteryWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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)); const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
if (layoutPopoutLoader.item.setTriggerPosition) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, layoutWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "center"; 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); 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) { 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 pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, vpnWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right"; 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); 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; controlCenterLoader.item.triggerScreen = barWindow.screen;
if (controlCenterLoader.item.setTriggerPosition) { if (controlCenterLoader.item.setTriggerPosition) {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
// Use topBarContent.barConfig directly // Use topBarContent.barConfig directly
const effectiveBarConfig = topBarContent.barConfig; const effectiveBarConfig = topBarContent.barConfig;
// Calculate barPosition from axis.edge like Battery widget does // Calculate barPosition from axis.edge like Battery widget does

View File

@@ -27,10 +27,9 @@ PanelWindow {
} }
if (controlCenterButtonRef && controlCenterLoader.item.setTriggerPosition) { if (controlCenterButtonRef && controlCenterLoader.item.setTriggerPosition) {
const globalPos = controlCenterButtonRef.mapToGlobal(0, 0); const screenPos = controlCenterButtonRef.mapToItem(null, 0, 0);
// Calculate barPosition from axis.edge
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); 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"; const section = controlCenterButtonRef.section || "right";
controlCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig); controlCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig);
} else { } else {
@@ -54,29 +53,24 @@ PanelWindow {
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
const section = clockButtonRef.section || "center"; const section = clockButtonRef.section || "center";
// For center section widgets, use center section bounds for DankDash centering
let triggerPos, triggerWidth; let triggerPos, triggerWidth;
if (section === "center") { if (section === "center") {
const centerSection = barWindow.isVertical ? (barWindow.axis?.edge === "left" ? topBarContent.vCenterSection : topBarContent.vCenterSection) : topBarContent.hCenterSection; const centerSection = barWindow.isVertical ? (barWindow.axis?.edge === "left" ? topBarContent.vCenterSection : topBarContent.vCenterSection) : topBarContent.hCenterSection;
if (centerSection) { if (centerSection) {
// For vertical bars, use center Y of section; for horizontal, use left edge
if (barWindow.isVertical) { if (barWindow.isVertical) {
const centerY = centerSection.height / 2; const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY); triggerPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.height; triggerWidth = centerSection.height;
} else { } else {
// For horizontal bars, use left edge (DankPopout will center it) triggerPos = centerSection.mapToItem(null, 0, 0);
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.width; triggerWidth = centerSection.width;
} }
} else { } else {
triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0); triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
triggerWidth = clockButtonRef.visualWidth; triggerWidth = clockButtonRef.visualWidth;
} }
} else { } else {
triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0); triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
triggerWidth = clockButtonRef.visualWidth; triggerWidth = clockButtonRef.visualWidth;
} }

View File

@@ -264,14 +264,14 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: Theme.widgetIconColor color: Theme.widgetIconColor
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
} }
StyledText { StyledText {
id: audioPercentV id: audioPercentV
visible: root.showAudioPercent 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) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor color: Theme.widgetTextColor
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -305,14 +305,14 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: root.getMicIconColor() color: root.getMicIconColor()
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
} }
StyledText { StyledText {
id: micPercentV id: micPercentV
visible: root.showMicPercent 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) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor color: Theme.widgetTextColor
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -346,7 +346,7 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: Theme.widgetIconColor color: Theme.widgetIconColor
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
} }
@@ -442,14 +442,14 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: Theme.widgetIconColor color: Theme.widgetIconColor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent anchors.left: parent.left
anchors.leftMargin: 2 anchors.leftMargin: 2
} }
StyledText { StyledText {
id: audioPercent id: audioPercent
visible: root.showAudioPercent 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) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor color: Theme.widgetTextColor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -484,14 +484,14 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: root.getMicIconColor() color: root.getMicIconColor()
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent anchors.left: parent.left
anchors.leftMargin: 2 anchors.leftMargin: 2
} }
StyledText { StyledText {
id: micPercent id: micPercent
visible: root.showMicPercent 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) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor color: Theme.widgetTextColor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -526,7 +526,7 @@ BasePill {
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: Theme.widgetIconColor color: Theme.widgetIconColor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent anchors.left: parent.left
anchors.leftMargin: 2 anchors.leftMargin: 2
} }

View File

@@ -139,7 +139,7 @@ BasePill {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) { 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 currentScreen = root.parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width);
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen); root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
@@ -294,7 +294,7 @@ BasePill {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onPressed: { onPressed: {
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) { if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
const currentScreen = root.parentScreen || Screen; const currentScreen = root.parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width);
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen); root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);

View File

@@ -12,7 +12,7 @@ BasePill {
readonly property bool isChecking: SystemUpdateService.isChecking readonly property bool isChecking: SystemUpdateService.isChecking
readonly property real horizontalPadding: (barConfig?.noBackground ?? false) ? 2 : Theme.spacingS 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 { Ref {
service: SystemUpdateService service: SystemUpdateService
@@ -28,16 +28,21 @@ BasePill {
anchors.centerIn: parent anchors.centerIn: parent
visible: root.isVerticalOrientation visible: root.isVerticalOrientation
name: { name: {
if (root.isChecking) return "refresh" if (root.isChecking)
if (SystemUpdateService.hasError) return "error" return "refresh";
if (root.hasUpdates) return "system_update_alt" if (SystemUpdateService.hasError)
return "check_circle" return "error";
if (root.hasUpdates)
return "system_update_alt";
return "check_circle";
} }
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: { color: {
if (SystemUpdateService.hasError) return Theme.error if (SystemUpdateService.hasError)
if (root.hasUpdates) return Theme.primary return Theme.error;
return root.isActive ? Theme.primary : Theme.surfaceText if (root.hasUpdates)
return Theme.primary;
return root.isActive ? Theme.primary : Theme.surfaceText;
} }
RotationAnimation { RotationAnimation {
@@ -52,7 +57,7 @@ BasePill {
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running) {
statusIcon.rotation = 0 statusIcon.rotation = 0;
} }
} }
} }
@@ -80,16 +85,21 @@ BasePill {
id: statusIconHorizontal id: statusIconHorizontal
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
name: { name: {
if (root.isChecking) return "refresh" if (root.isChecking)
if (SystemUpdateService.hasError) return "error" return "refresh";
if (root.hasUpdates) return "system_update_alt" if (SystemUpdateService.hasError)
return "check_circle" return "error";
if (root.hasUpdates)
return "system_update_alt";
return "check_circle";
} }
size: Theme.barIconSize(root.barThickness, -4) size: Theme.barIconSize(root.barThickness, -4)
color: { color: {
if (SystemUpdateService.hasError) return Theme.error if (SystemUpdateService.hasError)
if (root.hasUpdates) return Theme.primary return Theme.error;
return root.isActive ? Theme.primary : Theme.surfaceText if (root.hasUpdates)
return Theme.primary;
return root.isActive ? Theme.primary : Theme.surfaceText;
} }
RotationAnimation { RotationAnimation {
@@ -104,7 +114,7 @@ BasePill {
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running) {
statusIconHorizontal.rotation = 0 statusIconHorizontal.rotation = 0;
} }
} }
} }
@@ -128,12 +138,12 @@ BasePill {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onPressed: { onPressed: {
if (popoutTarget && popoutTarget.setTriggerPosition) { if (popoutTarget && popoutTarget.setTriggerPosition) {
const globalPos = root.visualContent.mapToGlobal(0, 0) const globalPos = root.visualContent.mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth) const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth);
popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen) popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen);
} }
root.clicked() root.clicked();
} }
} }
} }

View File

@@ -137,7 +137,7 @@ Item {
} }
if (popoutTarget.setTriggerPosition) { if (popoutTarget.setTriggerPosition) {
const globalPos = root.visualContent.mapToGlobal(0, 0); const globalPos = root.visualContent.mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const barPosition = root.axis?.edge === "left" ? 2 : (root.axis?.edge === "right" ? 3 : (root.axis?.edge === "top" ? 0 : 1)); 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); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth, root.barSpacing, barPosition, root.barConfig);

View File

@@ -119,7 +119,7 @@ Item {
if (pillClickAction.length === 0) { if (pillClickAction.length === 0) {
pillClickAction(); pillClickAction();
} else { } else {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
@@ -133,7 +133,7 @@ Item {
if (pillRightClickAction.length === 0) { if (pillRightClickAction.length === 0) {
pillRightClickAction(); pillRightClickAction();
} else { } else {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen); pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen);
@@ -160,7 +160,7 @@ Item {
if (pillClickAction.length === 0) { if (pillClickAction.length === 0) {
pillClickAction(); pillClickAction();
} else { } else {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
@@ -174,7 +174,7 @@ Item {
if (pillRightClickAction.length === 0) { if (pillRightClickAction.length === 0) {
pillRightClickAction(); pillRightClickAction();
} else { } else {
const globalPos = mapToGlobal(0, 0); const globalPos = mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen); pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen);
@@ -196,7 +196,7 @@ Item {
return; return;
} }
const pill = isVertical ? verticalPill : horizontalPill; const pill = isVertical ? verticalPill : horizontalPill;
const globalPos = pill.mapToGlobal(0, 0); const globalPos = pill.mapToItem(null, 0, 0);
const currentScreen = parentScreen || Screen; const currentScreen = parentScreen || Screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.width); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.width);
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen); pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
@@ -206,7 +206,7 @@ Item {
return; return;
const pill = isVertical ? verticalPill : horizontalPill; 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 currentScreen = parentScreen || Screen;
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); 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); const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.visualWidth, barSpacing, barPosition, barConfig);