From 6742adce3df5cf3eba246427018f5ec34062c6f2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 18 Jul 2026 21:19:14 -0700 Subject: [PATCH] Focus weather city input on return --- shell/Ui/PanelKeyCatcher.qml | 7 ++++++- shell/plugins/panels/weather/Panel.qml | 1 + test/shell.d/weather-test.sh | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/shell/Ui/PanelKeyCatcher.qml b/shell/Ui/PanelKeyCatcher.qml index 27e5bebc..bac394e5 100644 --- a/shell/Ui/PanelKeyCatcher.qml +++ b/shell/Ui/PanelKeyCatcher.qml @@ -37,6 +37,7 @@ Item { signal moveRequested(int dx, int dy) signal activateRequested() + signal returnRequested() signal closeRequested() signal deleteRequested() signal tabRequested(int direction) @@ -67,7 +68,11 @@ Item { if (event.key === Qt.Key_Left || event.text === "h") { moveRequested(-1, 0); event.accepted = true; return } - if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { + returnRequested() + activateRequested(); event.accepted = true; return + } + if (event.key === Qt.Key_Space) { activateRequested(); event.accepted = true; return } if (event.text === "x" || event.text === "X") { diff --git a/shell/plugins/panels/weather/Panel.qml b/shell/plugins/panels/weather/Panel.qml index b119018e..4ff00c79 100644 --- a/shell/plugins/panels/weather/Panel.qml +++ b/shell/plugins/panels/weather/Panel.qml @@ -450,6 +450,7 @@ Panel { id: keyCatcher anchors.fill: parent blocked: root.editingLocation + onReturnRequested: root.startEditingLocation() onCloseRequested: root.close() onTabRequested: function(direction) { root.switchPanel(direction) } diff --git a/test/shell.d/weather-test.sh b/test/shell.d/weather-test.sh index 5b2aab46..fe5c1a04 100644 --- a/test/shell.d/weather-test.sh +++ b/test/shell.d/weather-test.sh @@ -118,6 +118,10 @@ assert( fs.readFileSync(root + '/shell/plugins/panels/weather/Panel.qml', 'utf8').includes('text: root.label || "—"'), 'weather hero and bar use the same resolved icon' ) +assert( + fs.readFileSync(root + '/shell/plugins/panels/weather/Panel.qml', 'utf8').includes('onReturnRequested: root.startEditingLocation()'), + 'weather focuses city input when Return is pressed' +) assert(!weather.weatherResponseCompletesSave(true, 'wttr'), 'weather keeps the spinner through a non-authoritative pinned-location response') assert(weather.weatherResponseCompletesSave(true, 'open-meteo'), 'weather completes a pinned-location save with Open-Meteo data') assert(weather.weatherResponseCompletesSave(false, 'wttr'), 'weather completes a name-only location save with wttr data')