From f263df3ccdc7eab6d3befe8f189715df3cf27b59 Mon Sep 17 00:00:00 2001 From: Soramane <61896496+soramanew@users.noreply.github.com> Date: Wed, 16 Jul 2025 21:44:27 +1000 Subject: internal: create service config --- config/Config.qml | 2 ++ config/DashboardConfig.qml | 2 -- config/ServiceConfig.qml | 6 ++++++ modules/dashboard/dash/Weather.qml | 2 +- modules/lock/WeatherInfo.qml | 2 +- services/Weather.qml | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 config/ServiceConfig.qml diff --git a/config/Config.qml b/config/Config.qml index f95e38f..2b8eff7 100644 --- a/config/Config.qml +++ b/config/Config.qml @@ -16,6 +16,7 @@ Singleton { property alias session: adapter.session property alias winfo: adapter.winfo property alias lock: adapter.lock + property alias services: adapter.services property alias paths: adapter.paths FileView { @@ -36,6 +37,7 @@ Singleton { property JsonObject session: SessionConfig {} property JsonObject winfo: WInfoConfig {} property JsonObject lock: LockConfig {} + property JsonObject services: ServiceConfig {} property JsonObject paths: UserPaths {} } } diff --git a/config/DashboardConfig.qml b/config/DashboardConfig.qml index 201b8d3..269d4b4 100644 --- a/config/DashboardConfig.qml +++ b/config/DashboardConfig.qml @@ -3,8 +3,6 @@ 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 bool useFahrenheit: false property JsonObject sizes: JsonObject { readonly property int tabIndicatorHeight: 3 diff --git a/config/ServiceConfig.qml b/config/ServiceConfig.qml new file mode 100644 index 0000000..0b8b170 --- /dev/null +++ b/config/ServiceConfig.qml @@ -0,0 +1,6 @@ +import Quickshell.Io + +JsonObject { + property string weatherLocation: "" // A lat,long pair or empty for autodetection, e.g. "37.8267,-122.4233" + property bool useFahrenheit: false +} diff --git a/modules/dashboard/dash/Weather.qml b/modules/dashboard/dash/Weather.qml index 52d026d..6bb9792 100644 --- a/modules/dashboard/dash/Weather.qml +++ b/modules/dashboard/dash/Weather.qml @@ -38,7 +38,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter animate: true - text: Config.dashboard.useFahrenheit ? Weather.tempF : Weather.tempC + text: Config.services.useFahrenheit ? Weather.tempF : Weather.tempC color: Colours.palette.m3primary font.pointSize: Appearance.font.size.extraLarge font.weight: 500 diff --git a/modules/lock/WeatherInfo.qml b/modules/lock/WeatherInfo.qml index bbb529f..c5d1cf5 100644 --- a/modules/lock/WeatherInfo.qml +++ b/modules/lock/WeatherInfo.qml @@ -40,7 +40,7 @@ RowLayout { Layout.fillWidth: true animate: true - text: Config.dashboard.useFahrenheit ? Weather.tempF : Weather.tempC + text: Config.services.useFahrenheit ? Weather.tempF : Weather.tempC color: Colours.palette.m3primary horizontalAlignment: Text.AlignHCenter font.pointSize: Appearance.font.size.extraLarge diff --git a/services/Weather.qml b/services/Weather.qml index 493a2a0..38750ae 100644 --- a/services/Weather.qml +++ b/services/Weather.qml @@ -15,8 +15,8 @@ Singleton { property string tempF: "0°F" function reload(): void { - if (Config.dashboard.weatherLocation) - loc = Config.dashboard.weatherLocation; + if (Config.services.weatherLocation) + loc = Config.services.weatherLocation; else if (!loc || timer.elapsed() > 900) Requests.get("https://ipinfo.io/json", text => { loc = JSON.parse(text).loc ?? ""; -- cgit v1.2.3-freya