1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

dankbar/controlcenter: add VPN, mic, brightness, battery, and printer

options for widget
This commit is contained in:
bbedward
2025-11-24 16:36:49 -05:00
parent 7f15227de1
commit d341a5a60b
15 changed files with 1692 additions and 1486 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,8 @@
pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
Singleton {
id: root
@@ -70,6 +67,14 @@ Singleton {
property bool subscriptionConnected: activeService?.subscriptionConnected ?? false
property var vpnProfiles: activeService?.vpnProfiles ?? []
property var vpnActive: activeService?.vpnActive ?? []
property bool vpnAvailable: activeService?.vpnAvailable ?? false
property bool vpnIsBusy: activeService?.vpnIsBusy ?? false
property bool vpnConnected: activeService?.vpnConnected ?? false
property string vpnActiveUuid: activeService?.activeUuid ?? ""
property string vpnActiveName: activeService?.activeName ?? ""
property string credentialsToken: activeService?.credentialsToken ?? ""
property string credentialsSSID: activeService?.credentialsSSID ?? ""
property string credentialsSetting: activeService?.credentialsSetting ?? ""
@@ -88,12 +93,12 @@ Singleton {
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
Component.onCompleted: {
console.info("NetworkService: Initializing...")
console.info("NetworkService: Initializing...");
if (!socketPath || socketPath.length === 0) {
console.info("NetworkService: DMS_SOCKET not set, using LegacyNetworkService")
useLegacyService()
console.info("NetworkService: DMS_SOCKET not set, using LegacyNetworkService");
useLegacyService();
} else {
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...")
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...");
}
}
@@ -102,191 +107,191 @@ Singleton {
function onNetworkAvailableChanged() {
if (!activeService && DMSNetworkService.networkAvailable) {
console.info("NetworkService: Network capability detected, using DMSNetworkService")
activeService = DMSNetworkService
usingLegacy = false
console.info("NetworkService: Switched to DMSNetworkService, networkAvailable:", networkAvailable)
connectSignals()
console.info("NetworkService: Network capability detected, using DMSNetworkService");
activeService = DMSNetworkService;
usingLegacy = false;
console.info("NetworkService: Switched to DMSNetworkService, networkAvailable:", networkAvailable);
connectSignals();
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
console.info("NetworkService: Network capability not available in DMS, using LegacyNetworkService")
useLegacyService()
console.info("NetworkService: Network capability not available in DMS, using LegacyNetworkService");
useLegacyService();
}
}
}
function useLegacyService() {
activeService = LegacyNetworkService
usingLegacy = true
console.info("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable)
activeService = LegacyNetworkService;
usingLegacy = true;
console.info("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable);
if (LegacyNetworkService.activate) {
LegacyNetworkService.activate()
LegacyNetworkService.activate();
}
connectSignals()
connectSignals();
}
function connectSignals() {
if (activeService) {
if (activeService.networksUpdated) {
activeService.networksUpdated.connect(root.networksUpdated)
activeService.networksUpdated.connect(root.networksUpdated);
}
if (activeService.connectionChanged) {
activeService.connectionChanged.connect(root.connectionChanged)
activeService.connectionChanged.connect(root.connectionChanged);
}
if (activeService.credentialsNeeded) {
activeService.credentialsNeeded.connect(root.credentialsNeeded)
activeService.credentialsNeeded.connect(root.credentialsNeeded);
}
}
}
function addRef() {
if (activeService && activeService.addRef) {
activeService.addRef()
activeService.addRef();
}
}
function removeRef() {
if (activeService && activeService.removeRef) {
activeService.removeRef()
activeService.removeRef();
}
}
function getState() {
if (activeService && activeService.getState) {
activeService.getState()
activeService.getState();
}
}
function scanWifi() {
if (activeService && activeService.scanWifi) {
activeService.scanWifi()
activeService.scanWifi();
}
}
function scanWifiNetworks() {
if (activeService && activeService.scanWifiNetworks) {
activeService.scanWifiNetworks()
activeService.scanWifiNetworks();
}
}
function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") {
if (activeService && activeService.connectToWifi) {
activeService.connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch)
activeService.connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch);
}
}
function disconnectWifi() {
if (activeService && activeService.disconnectWifi) {
activeService.disconnectWifi()
activeService.disconnectWifi();
}
}
function forgetWifiNetwork(ssid) {
if (activeService && activeService.forgetWifiNetwork) {
activeService.forgetWifiNetwork(ssid)
activeService.forgetWifiNetwork(ssid);
}
}
function toggleWifiRadio() {
if (activeService && activeService.toggleWifiRadio) {
activeService.toggleWifiRadio()
activeService.toggleWifiRadio();
}
}
function enableWifiDevice() {
if (activeService && activeService.enableWifiDevice) {
activeService.enableWifiDevice()
activeService.enableWifiDevice();
}
}
function setNetworkPreference(preference) {
if (activeService && activeService.setNetworkPreference) {
activeService.setNetworkPreference(preference)
activeService.setNetworkPreference(preference);
}
}
function setConnectionPriority(type) {
if (activeService && activeService.setConnectionPriority) {
activeService.setConnectionPriority(type)
activeService.setConnectionPriority(type);
}
}
function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") {
if (activeService && activeService.connectToWifiAndSetPreference) {
activeService.connectToWifiAndSetPreference(ssid, password, username, anonymousIdentity, domainSuffixMatch)
activeService.connectToWifiAndSetPreference(ssid, password, username, anonymousIdentity, domainSuffixMatch);
}
}
function toggleNetworkConnection(type) {
if (activeService && activeService.toggleNetworkConnection) {
activeService.toggleNetworkConnection(type)
activeService.toggleNetworkConnection(type);
}
}
function startAutoScan() {
if (activeService && activeService.startAutoScan) {
activeService.startAutoScan()
activeService.startAutoScan();
}
}
function stopAutoScan() {
if (activeService && activeService.stopAutoScan) {
activeService.stopAutoScan()
activeService.stopAutoScan();
}
}
function fetchNetworkInfo(ssid) {
if (activeService && activeService.fetchNetworkInfo) {
activeService.fetchNetworkInfo(ssid)
activeService.fetchNetworkInfo(ssid);
}
}
function fetchWiredNetworkInfo(uuid) {
if (activeService && activeService.fetchWiredNetworkInfo) {
activeService.fetchWiredNetworkInfo(uuid)
activeService.fetchWiredNetworkInfo(uuid);
}
}
function getNetworkInfo(ssid) {
if (activeService && activeService.getNetworkInfo) {
return activeService.getNetworkInfo(ssid)
return activeService.getNetworkInfo(ssid);
}
return null
return null;
}
function getWiredNetworkInfo(uuid) {
if (activeService && activeService.getWiredNetworkInfo) {
return activeService.getWiredNetworkInfo(uuid)
return activeService.getWiredNetworkInfo(uuid);
}
return null
return null;
}
function refreshNetworkState() {
if (activeService && activeService.refreshNetworkState) {
activeService.refreshNetworkState()
activeService.refreshNetworkState();
}
}
function connectToSpecificWiredConfig(uuid) {
if (activeService && activeService.connectToSpecificWiredConfig) {
activeService.connectToSpecificWiredConfig(uuid)
activeService.connectToSpecificWiredConfig(uuid);
}
}
function submitCredentials(token, secrets, save) {
if (activeService && activeService.submitCredentials) {
activeService.submitCredentials(token, secrets, save)
activeService.submitCredentials(token, secrets, save);
}
}
function cancelCredentials(token) {
if (activeService && activeService.cancelCredentials) {
activeService.cancelCredentials(token)
activeService.cancelCredentials(token);
}
}
function setWifiAutoconnect(ssid, autoconnect) {
if (activeService && activeService.setWifiAutoconnect) {
activeService.setWifiAutoconnect(ssid, autoconnect)
activeService.setWifiAutoconnect(ssid, autoconnect);
}
}
}