feat: configurable weather location

Impls #76
This commit is contained in:
2 * r + 2 * t 2025-06-16 00:50:38 +10:00
parent a1da662c38
commit 4fe6ff22f6
2 changed files with 8 additions and 2 deletions

View file

@ -3,6 +3,7 @@ import Quickshell.Io
JsonObject { JsonObject {
property int mediaUpdateInterval: 500 property int mediaUpdateInterval: 500
property int visualiserBars: 45 property int visualiserBars: 45
property string weatherLocation: "" // A lat,long pair, e.g. "37.8267,-122.4233"
property JsonObject sizes: JsonObject { property JsonObject sizes: JsonObject {
readonly property int tabIndicatorHeight: 3 readonly property int tabIndicatorHeight: 3

View file

@ -1,8 +1,10 @@
pragma Singleton pragma Singleton
import "root:/config"
import "root:/utils" import "root:/utils"
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import QtQuick
Singleton { Singleton {
id: root id: root
@ -13,15 +15,18 @@ Singleton {
property real temperature property real temperature
function reload(): void { function reload(): void {
wttrProc.running = true; if (Config.dashboard.weatherLocation)
loc = Config.dashboard.weatherLocation;
else
ipProc.running = true;
} }
onLocChanged: wttrProc.running = true onLocChanged: wttrProc.running = true
Component.onCompleted: reload()
Process { Process {
id: ipProc id: ipProc
running: true
command: ["curl", "ipinfo.io"] command: ["curl", "ipinfo.io"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: root.loc = JSON.parse(text).loc onStreamFinished: root.loc = JSON.parse(text).loc