Remove obsolete weather status poller (#6555)
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
# omarchy:summary=Returns a weather condition icon, adjusted for live sunrise and sunset.
|
# omarchy:summary=Returns a weather condition icon, adjusted for live sunrise and sunset.
|
||||||
|
|
||||||
# Only consult the helper when a location is stored: this runs every minute,
|
# Only consult the helper when a location is stored. Its dynamic fallback would
|
||||||
# and the helper's dynamic fallback would cost an extra wttr.in request when
|
# cost an extra wttr.in request when nothing is set; the bare j1 fetch already
|
||||||
# nothing is set — the bare j1 fetch already auto-detects by IP.
|
# auto-detects by IP.
|
||||||
query=""
|
query=""
|
||||||
if [[ -s "$HOME/.local/state/omarchy/settings/weather.json" ]]; then
|
if [[ -s "$HOME/.local/state/omarchy/settings/weather.json" ]]; then
|
||||||
location=$(omarchy-weather-location 2>/dev/null)
|
location=$(omarchy-weather-location 2>/dev/null)
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ BarWidget {
|
|||||||
bar: root.bar
|
bar: root.bar
|
||||||
text: panelLoader.item ? panelLoader.item.label : ""
|
text: panelLoader.item ? panelLoader.item.label : ""
|
||||||
slotSize: Style.bar.statusSlot
|
slotSize: Style.bar.statusSlot
|
||||||
active: panelLoader.item && panelLoader.item.klass === "active"
|
|
||||||
// Tooltip suppressed because the panel is the detail view.
|
// Tooltip suppressed because the panel is the detail view.
|
||||||
tooltipText: ""
|
tooltipText: ""
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,3 @@
|
|||||||
function parseWeatherStatus(raw) {
|
|
||||||
try {
|
|
||||||
var data = JSON.parse(String(raw || "{}"))
|
|
||||||
return {
|
|
||||||
label: data.text || "",
|
|
||||||
klass: data.class || ""
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
return { label: "", klass: "" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// weather.json holds {"name": ..., "latitude": ..., "longitude": ...} (see
|
// weather.json holds {"name": ..., "latitude": ..., "longitude": ...} (see
|
||||||
// omarchy-weather-location, which owns the format). Missing, blank, or
|
// omarchy-weather-location, which owns the format). Missing, blank, or
|
||||||
// unparseable means the location is auto-detected from the IP address.
|
// unparseable means the location is auto-detected from the IP address.
|
||||||
@@ -279,7 +267,6 @@ function iconForCode(code, night) {
|
|||||||
|
|
||||||
if (typeof module !== "undefined") {
|
if (typeof module !== "undefined") {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
parseWeatherStatus: parseWeatherStatus,
|
|
||||||
parseLocationFile: parseLocationFile,
|
parseLocationFile: parseLocationFile,
|
||||||
wttrLocationQuery: wttrLocationQuery,
|
wttrLocationQuery: wttrLocationQuery,
|
||||||
parseGeocodingResults: parseGeocodingResults,
|
parseGeocodingResults: parseGeocodingResults,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ Panel {
|
|||||||
ipcTarget: "omarchy.weather"
|
ipcTarget: "omarchy.weather"
|
||||||
manageIpc: false
|
manageIpc: false
|
||||||
|
|
||||||
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
|
|
||||||
property var anchorItem: null
|
property var anchorItem: null
|
||||||
property bool openedFromHotkey: false
|
property bool openedFromHotkey: false
|
||||||
|
|
||||||
@@ -126,7 +125,6 @@ Panel {
|
|||||||
|
|
||||||
// Shared hero/bar icon state, updated with each successful weather response.
|
// Shared hero/bar icon state, updated with each successful weather response.
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property string klass: ""
|
|
||||||
|
|
||||||
// wttr's current conditions when available; open-meteo's (bundled with the
|
// wttr's current conditions when available; open-meteo's (bundled with the
|
||||||
// much faster daily forecast fetch) fill the hero while wttr is in flight.
|
// much faster daily forecast fetch) fill the hero while wttr is in flight.
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
icon=$(omarchy-weather-icon 2>/dev/null)
|
|
||||||
|
|
||||||
if [[ -n $icon ]]; then
|
|
||||||
icon=$(printf '%s' "$icon" | sed 's/["\\]/\\&/g')
|
|
||||||
printf '{"text":"%s"}\n' "$icon"
|
|
||||||
else
|
|
||||||
printf '{"text":"","class":"unavailable"}\n'
|
|
||||||
fi
|
|
||||||
@@ -10,13 +10,6 @@ const weather = requireFromRoot('shell/plugins/panels/weather/Model.js')
|
|||||||
const panelSource = fs.readFileSync(root + '/shell/plugins/panels/weather/Panel.qml', 'utf8')
|
const panelSource = fs.readFileSync(root + '/shell/plugins/panels/weather/Panel.qml', 'utf8')
|
||||||
const widgetSource = fs.readFileSync(root + '/shell/plugins/panels/weather/BarWidget.qml', 'utf8')
|
const widgetSource = fs.readFileSync(root + '/shell/plugins/panels/weather/BarWidget.qml', 'utf8')
|
||||||
|
|
||||||
assertDeepEqual(
|
|
||||||
weather.parseWeatherStatus('{"text":"☀","class":"sunny"}'),
|
|
||||||
{ label: '☀', klass: 'sunny' },
|
|
||||||
'weather parses pill status JSON'
|
|
||||||
)
|
|
||||||
assertDeepEqual(weather.parseWeatherStatus('{'), { label: '', klass: '' }, 'weather handles invalid pill status JSON')
|
|
||||||
|
|
||||||
assertDeepEqual(weather.parseLocationFile('{"name": "Malibu", "latitude": 34.02577, "longitude": -118.7804}\n'), { name: 'Malibu', latitude: 34.02577, longitude: -118.7804 }, 'weather parses name plus coordinates from weather.json')
|
assertDeepEqual(weather.parseLocationFile('{"name": "Malibu", "latitude": 34.02577, "longitude": -118.7804}\n'), { name: 'Malibu', latitude: 34.02577, longitude: -118.7804 }, 'weather parses name plus coordinates from weather.json')
|
||||||
assertDeepEqual(weather.parseLocationFile('{"name": "New York"}'), { name: 'New York', latitude: null, longitude: null }, 'weather parses a name-only weather.json')
|
assertDeepEqual(weather.parseLocationFile('{"name": "New York"}'), { name: 'New York', latitude: null, longitude: null }, 'weather parses a name-only weather.json')
|
||||||
assertDeepEqual(weather.parseLocationFile('{"name": "Malibu", "latitude": 34.02577}'), { name: 'Malibu', latitude: null, longitude: null }, 'weather requires both coordinates')
|
assertDeepEqual(weather.parseLocationFile('{"name": "Malibu", "latitude": 34.02577}'), { name: 'Malibu', latitude: null, longitude: null }, 'weather requires both coordinates')
|
||||||
|
|||||||
Reference in New Issue
Block a user