From 4fe6ff22f6def77f30170c007c185685a13a9a2e Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 16 Jun 2025 00:50:38 +1000 Subject: feat: configurable weather location Impls #76 --- config/DashboardConfig.qml | 1 + services/Weather.qml | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/DashboardConfig.qml b/config/DashboardConfig.qml index 269d4b4..02f838e 100644 --- a/config/DashboardConfig.qml +++ b/config/DashboardConfig.qml @@ -3,6 +3,7 @@ import Quickshell.Io JsonObject { property int mediaUpdateInterval: 500 property int visualiserBars: 45 + property string weatherLocation: "" // A lat,long pair, e.g. "37.8267,-122.4233" property JsonObject sizes: JsonObject { readonly property int tabIndicatorHeight: 3 diff --git a/services/Weather.qml b/services/Weather.qml index 4f53d0b..29858eb 100644 --- a/services/Weather.qml +++ b/services/Weather.qml @@ -1,8 +1,10 @@ pragma Singleton +import "root:/config" import "root:/utils" import Quickshell import Quickshell.Io +import QtQuick Singleton { id: root @@ -13,15 +15,18 @@ Singleton { property real temperature function reload(): void { - wttrProc.running = true; + if (Config.dashboard.weatherLocation) + loc = Config.dashboard.weatherLocation; + else + ipProc.running = true; } onLocChanged: wttrProc.running = true + Component.onCompleted: reload() Process { id: ipProc - running: true command: ["curl", "ipinfo.io"] stdout: StdioCollector { onStreamFinished: root.loc = JSON.parse(text).loc -- cgit v1.2.3-freya