1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 21:02:06 -04:00

Add GeoClue2 integration as alternative to IP location (#1856)

* feat: switch auto location in weather widget to use GeoClue2 instead of simple IP check

* nix: enable GeoClue2 service by default

* lint: fix line endings

* fix: fall back to IP location if GeoClue is not available
This commit is contained in:
Sunner
2026-02-28 04:29:08 +01:00
committed by GitHub
parent ab211266a6
commit 7bea6b4a62
19 changed files with 974 additions and 71 deletions

View File

@@ -0,0 +1,51 @@
pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
Singleton {
id: root
readonly property bool locationAvailable: DMSService.isConnected && (DMSService.capabilities.length === 0 || DMSService.capabilities.includes("location"))
property var latitude: 0.0
property var longitude: 0.0
signal locationChanged(var data)
Component.onCompleted: {
console.info("LocationService: Initializing...");
getState();
}
Connections {
target: DMSService
function onLocationStateUpdate(data) {
if (locationAvailable) {
handleStateUpdate(data);
}
}
}
function handleStateUpdate(data) {
root.latitude = data.latitude;
root.longitude = data.longitude;
root.locationChanged(data)
}
function getState() {
if (!locationAvailable)
return;
DMSService.sendRequest("location.getState", null, response => {
if (response.result) {
handleStateUpdate(response.result);
}
});
}
}