1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

network: avoid dropping to legacy service when loading

This commit is contained in:
bbedward
2026-07-14 22:56:28 -04:00
parent 3c5245914f
commit 4af3225f21
+24 -6
View File
@@ -100,14 +100,28 @@ Singleton {
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
// Backend adoption must be state-checked here, not only edge-triggered below:
// with staged shell loading this singleton can be instantiated after
// DMSNetworkService already resolved its capabilities, so the change signal
// may never fire again.
Component.onCompleted: {
log.info("Initializing...");
if (!socketPath || socketPath.length === 0) {
log.info("DMS_SOCKET not set, using LegacyNetworkService");
useLegacyService();
} else {
log.debug("DMS_SOCKET found, waiting for capabilities...");
return;
}
if (DMSNetworkService.networkAvailable) {
log.info("Network capability already available, using DMSNetworkService");
useDMSService();
return;
}
if (DMSService.isConnected && DMSService.capabilities.length > 0) {
log.info("Network capability not available in DMS, using LegacyNetworkService");
useLegacyService();
return;
}
log.debug("DMS_SOCKET found, waiting for capabilities...");
}
Connections {
@@ -116,10 +130,7 @@ Singleton {
function onNetworkAvailableChanged() {
if (!activeService && DMSNetworkService.networkAvailable) {
log.info("Network capability detected, using DMSNetworkService");
activeService = DMSNetworkService;
usingLegacy = false;
log.info("Switched to DMSNetworkService, networkAvailable:", networkAvailable);
connectSignals();
useDMSService();
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
log.info("Network capability not available in DMS, using LegacyNetworkService");
useLegacyService();
@@ -127,6 +138,13 @@ Singleton {
}
}
function useDMSService() {
activeService = DMSNetworkService;
usingLegacy = false;
log.info("Switched to DMSNetworkService, networkAvailable:", networkAvailable);
connectSignals();
}
function useLegacyService() {
activeService = LegacyNetworkService;
usingLegacy = true;