internal: create service config

This commit is contained in:
Soramane 2025-07-16 21:44:27 +10:00
parent 672a373637
commit f263df3ccd
6 changed files with 12 additions and 6 deletions

View file

@ -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 {}
}
}

View file

@ -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

6
config/ServiceConfig.qml Normal file
View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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 ?? "";