forked from Shinonome/dots-hyprland
feat(bar): unify popup handling and improve layouts
- Unified popup handling in ClockWidget, Resource, BatteryPopup, and WeatherBar using PanelWindow + LazyLoader for consistent positioning and compositor animations. - Replaced plain text with ColumnLayout and RowLayout where possible, adding MaterialSymbol icons for improved visual consistency with the overall desktop style. - Added Translation.tr() for bilingual (Chinese/English) support to avoid hardcoded strings. - Based on improvements from PR #1771 (mine) and PR #1773 (by @finjener), merged and refined into a more polished and practical solution.
This commit is contained in:
@@ -40,18 +40,30 @@ MouseArea {
|
||||
id: popupLoader
|
||||
active: root.containsMouse
|
||||
|
||||
component: PopupWindow {
|
||||
component: PanelWindow {
|
||||
id: popupWindow
|
||||
visible: true
|
||||
implicitWidth: weatherPopup.implicitWidth
|
||||
implicitHeight: weatherPopup.implicitHeight
|
||||
anchor.item: root
|
||||
anchor.edges: Edges.Top
|
||||
anchor.rect.x: (root.implicitWidth - popupWindow.implicitWidth) / 2
|
||||
anchor.rect.y: Config.options.bar.bottom ?
|
||||
(-weatherPopup.implicitHeight - 15) :
|
||||
(root.implicitHeight + 15 )
|
||||
|
||||
color: "transparent"
|
||||
exclusiveZone: 0
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
|
||||
margins {
|
||||
left: root.mapToGlobal(Qt.point(
|
||||
(root.width - weatherPopup.implicitWidth) / 2,
|
||||
0
|
||||
)).x
|
||||
top: root.mapToGlobal(Qt.point(0, root.height)).y - 25
|
||||
}
|
||||
|
||||
mask: Region {
|
||||
item: weatherPopup
|
||||
}
|
||||
|
||||
WeatherPopup {
|
||||
id: weatherPopup
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user