mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 17:22:08 -04:00
fix: VpnPopout and Vpn widget tooltip positions (#1623)
* fix(vpn-widget): correct tooltip positioning for bottom bar alignment - Calculate tooltip Y position based on bar edge (bottom vs top) - Position tooltip above bar when edge is bottom to prevent overflow - Account for tooltip height when positioning on bottom edge - Use proper screen reference for consistent positioning across displays * fix(VpnPopout): use correct screen height for popup sizing - Fix popup height calculation to use the assigned screen property instead of the global Screen object - Prevents incorrect positioning when multiple screens are present - Fallback to Screen.height if screen property is not set * fix(widgets): close DankPopout when screen is removed - Add Connections handler to monitor Quickshell.onScreensChanged - Automatically close popout if its assigned screen no longer exists - Prevent orphaned popouts when displays are disconnected
This commit is contained in:
committed by
GitHub
parent
5b8b7b04be
commit
cc62aa4a9e
@@ -17,7 +17,7 @@ DankPopout {
|
|||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
|
|
||||||
popupWidth: 380
|
popupWidth: 380
|
||||||
popupHeight: Math.min(Screen.height - 100, contentLoader.item ? contentLoader.item.implicitHeight : 320)
|
popupHeight: Math.min((screen ? screen.height : Screen.height) - 100, contentLoader.item ? contentLoader.item.implicitHeight : 320)
|
||||||
triggerWidth: 70
|
triggerWidth: 70
|
||||||
screen: triggerScreen
|
screen: triggerScreen
|
||||||
shouldBeVisible: false
|
shouldBeVisible: false
|
||||||
|
|||||||
@@ -115,9 +115,19 @@ BasePill {
|
|||||||
const isLeft = root.axis?.edge === "left";
|
const isLeft = root.axis?.edge === "left";
|
||||||
tooltipLoader.item.show(tooltipText, screenX + tooltipX, adjustedY, currentScreen, isLeft, !isLeft);
|
tooltipLoader.item.show(tooltipText, screenX + tooltipX, adjustedY, currentScreen, isLeft, !isLeft);
|
||||||
} else {
|
} else {
|
||||||
const globalPos = mapToGlobal(width / 2, height);
|
const isBottom = root.axis?.edge === "bottom";
|
||||||
const tooltipY = root.barThickness + root.barSpacing + Theme.spacingXS;
|
const globalPos = mapToGlobal(width / 2, 0);
|
||||||
tooltipLoader.item.show(tooltipText, globalPos.x, tooltipY, root.parentScreen, false, false);
|
const currentScreen = root.parentScreen || Screen;
|
||||||
|
|
||||||
|
let tooltipY;
|
||||||
|
if (isBottom) {
|
||||||
|
const tooltipHeight = Theme.fontSizeSmall * 1.5 + Theme.spacingS * 2;
|
||||||
|
tooltipY = currentScreen.height - root.barThickness - root.barSpacing - Theme.spacingXS - tooltipHeight;
|
||||||
|
} else {
|
||||||
|
tooltipY = root.barThickness + root.barSpacing + Theme.spacingXS;
|
||||||
|
}
|
||||||
|
|
||||||
|
tooltipLoader.item.show(tooltipText, globalPos.x, tooltipY, currentScreen, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
|
|||||||
@@ -145,6 +145,25 @@ Item {
|
|||||||
shouldBeVisible ? close() : open();
|
shouldBeVisible ? close() : open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Quickshell
|
||||||
|
function onScreensChanged() {
|
||||||
|
if (!shouldBeVisible || !screen)
|
||||||
|
return;
|
||||||
|
const currentScreenName = screen.name;
|
||||||
|
let screenStillExists = false;
|
||||||
|
for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||||
|
if (Quickshell.screens[i].name === currentScreenName) {
|
||||||
|
screenStillExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!screenStillExists) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: closeTimer
|
id: closeTimer
|
||||||
interval: animationDuration
|
interval: animationDuration
|
||||||
|
|||||||
Reference in New Issue
Block a user