Files
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

67 lines
2.2 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Networking
Singleton {
id: root
property var backend: Networking
readonly property var devices: backend.devices.values
readonly property var wifiDevices: devices.filter(d => d.type === DeviceType.Wifi)
readonly property var networks: devices.reduce((all, d) => all.concat(d.networks.values), [])
readonly property bool available: backend.backend === NetworkBackendType.NetworkManager && wifiDevices.length > 0
readonly property bool enabled: backend.wifiEnabled
readonly property string summary: networks.filter(n => n.connected).map(n => n.name).join(", ") || (devices.some(d => d.connected) ? "Connected" : "Disconnected")
property bool scanning: false
property var pending: null
property string error: ""
onScanningChanged: syncScan()
onWifiDevicesChanged: syncScan()
function syncScan() {
wifiDevices.forEach(d => d.scannerEnabled = scanning);
}
function toggle() {
if (!available || !backend.wifiHardwareEnabled)
return false;
error = "";
backend.wifiEnabled = !enabled;
return true;
}
function connectNetwork(network, password) {
if (!network || pending || network.stateChanging)
return false;
error = "";
pending = network;
timeout.restart();
if (network.connected)
network.disconnect();
else if (password)
network.connectWithPsk(password);
else
network.connect();
return true;
}
Connections {
target: root.pending
function onConnectionFailed(reason) {
root.error = ConnectionFailReason.toString(reason);
timeout.stop();
root.pending = null;
}
function onStateChanged() {
if (root.pending && !root.pending.stateChanging) {
timeout.stop();
root.pending = null;
}
}
}
Timer {
id: timeout
interval: 20000
onTriggered: {
root.error = "No connection confirmation received. Check the network manager.";
root.pending = null;
}
}
}