Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion shell/plugins/panels/weather/Panel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Panel {

// Parsed wttr.in j1 response. Kept on failure so stale data stays visible.
property var report: null
// Width the hero row needs so the temperature and the stats column never
// overlap (labels are much wider in some languages, e.g. Russian).
property real heroNeededWidth: 0
property var dailyForecastReport: null

// Configured location, read from the weather.json state file (owned by
Expand Down Expand Up @@ -545,7 +548,7 @@ Panel {
// popup follows wherever the widget is placed.
centerOnBar: false
focusTarget: panel.loadedContent
contentWidth: panel.fittedContentWidth(Style.space(480))
contentWidth: panel.fittedContentWidth(Math.max(Style.space(480), root.heroNeededWidth + panel.padding * 2 + Style.space(4)))
contentHeight: panel.fittedContentHeight(panel.loadedContentHeight)

content: PanelKeyCatcher {
Expand Down Expand Up @@ -577,6 +580,13 @@ Panel {
width: parent.width
height: Math.max(heroLeft.height, heroRight.height)

// left margin + temperature block + gap + stats column + right margin
Binding {
target: root
property: "heroNeededWidth"
value: Style.space(16) + heroLeft.implicitWidth + Style.space(24) + heroRight.width + Style.space(20)
}

Row {
id: heroLeft
anchors.left: parent.left
Expand Down Expand Up @@ -636,6 +646,7 @@ Panel {
spacing: Style.space(12)

Row {
id: locationRow
visible: !root.editingLocation && root.reportLocation !== ""
spacing: Style.space(6)

Expand All @@ -647,6 +658,7 @@ Panel {
}

Text {
id: locationPin
text: "" // nf-fa-map_marker
color: Qt.darker(root.bar.foreground, 1.4)
font.family: root.bar.fontFamily
Expand All @@ -656,6 +668,9 @@ Panel {
Text {
textFormat: Text.PlainText
text: (root.reportLocation || "").toUpperCase()
// Long place names are elided instead of spilling past the panel.
width: Math.min(implicitWidth, heroRight.width - locationPin.width - locationRow.spacing)
elide: Text.ElideRight
color: Qt.darker(root.bar.foreground, 1.4)
font.family: root.bar.fontFamily
font.pixelSize: Style.font.body
Expand Down
13 changes: 13 additions & 0 deletions test/shell.d/weather-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,16 @@ chmod +x "$test_tmp/bin/curl"
[[ $(PATH="$test_tmp/bin:$PATH" weather_location) == "Amsterdam" ]] || fail "weather location names the place geo.omarchy.org detected"
[[ $(cat "$test_tmp/curl-urls") == "https://geo.omarchy.org/" ]] || fail "weather location asks only geo.omarchy.org" "$(cat "$test_tmp/curl-urls")"
pass "weather location names the place geo.omarchy.org detected when none is stored"

# Layout wiring for #17630: long-language stats must widen the panel (or
# elide the location), not collide with the temperature unit. Keep this
# compatible with a later narrow-screen scale (#11238 / #6991): fittedContentWidth
# still caps to the available card width.
panel_qml="$ROOT/shell/plugins/panels/weather/Panel.qml"
grep -q 'property real heroNeededWidth' "$panel_qml" || fail "weather panel tracks the hero width it needs"
grep -q 'Math.max(Style.space(480), root.heroNeededWidth' "$panel_qml" || fail "weather panel grows past 480 when the hero needs it"
grep -q 'elide: Text.ElideRight' "$panel_qml" || fail "weather location elides instead of spilling past the panel"
# The hero halves stay opposite-anchored (narrow-screen scale can still shrink
# them later); the Binding is what keeps them from overlapping today.
grep -q 'heroLeft.implicitWidth' "$panel_qml" || fail "weather heroNeededWidth Binding reads heroLeft.implicitWidth"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
pass "weather panel grows for long language labels and elides the location (#17630)"