bar: popups: fix and simplify positioning

This commit is contained in:
end-4 2025-08-11 15:52:54 +07:00
parent e39c1af5ae
commit 0beee14cd8
5 changed files with 10 additions and 25 deletions

View file

@ -97,8 +97,6 @@ MouseArea {
StyledPopup {
hoverTarget: root
offsetY: -30
maskEnabled: true
contentComponent: BatteryPopup {
id: batteryPopup
anchors.centerIn: parent

View file

@ -48,7 +48,6 @@ Item {
StyledPopup {
hoverTarget: mouseArea
offsetY: -30
contentComponent: Rectangle {
id: datePopup
readonly property real margin: 12

View file

@ -70,7 +70,6 @@ Item {
StyledPopup {
hoverTarget: mouseArea
offsetY: -30
contentComponent: Rectangle {
id: resourcePopup
readonly property real margin: 10

View file

@ -38,7 +38,6 @@ MouseArea {
StyledPopup {
hoverTarget: root
offsetY: -25
contentComponent: WeatherPopup {
id: weatherPopup
anchors.centerIn: parent

View file

@ -11,8 +11,6 @@ LazyLoader {
id: root
property Item hoverTarget
property real offsetY: -30
property bool maskEnabled: true
property Component contentComponent
active: hoverTarget && hoverTarget.containsMouse
@ -22,33 +20,25 @@ LazyLoader {
visible: true
color: "transparent"
exclusiveZone: 0
anchors.top: true
anchors.left: true
anchors.top: !Config.options.bar.bottom
anchors.bottom: Config.options.bar.bottom
implicitWidth: popupContent.implicitWidth
implicitHeight: popupContent.implicitHeight
margins {
left: hoverTarget
? hoverTarget.mapToGlobal(Qt.point(
(hoverTarget.width - popupContent.implicitWidth) / 2,
0
)).x
: 0
top: hoverTarget
? hoverTarget.mapToGlobal(Qt.point(0, hoverTarget.height)).y + offsetY
: 0
left: root.QsWindow?.mapFromItem(
root.hoverTarget,
(root.hoverTarget.width - popupContent.implicitWidth) / 2, 0
).x
top: Appearance.sizes.hyprlandGapsOut
bottom: Appearance.sizes.hyprlandGapsOut
}
mask: maskEnabled ? popupMask : undefined
WlrLayershell.namespace: "quickshell:styledPopup" //maybe this can fix with the popups not showing ?
WlrLayershell.namespace: "quickshell:popup" //maybe this can fix with the popups not showing ?
WlrLayershell.layer: WlrLayer.Overlay
Region {
id: popupMask
item: popupContent
}
Loader {
id: popupContent
sourceComponent: root.contentComponent