diff options
| author | ATMDA <atdma2600@gmail.com> | 2025-11-09 17:54:16 -0500 |
|---|---|---|
| committer | ATMDA <atdma2600@gmail.com> | 2025-11-09 17:54:16 -0500 |
| commit | 5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52 (patch) | |
| tree | 778ac9244f74c4100eee1bc6ee76b86e033d21b2 /services | |
| parent | [CI] chore: update flake (diff) | |
| download | caelestia-shell-5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52.tar.gz caelestia-shell-5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52.tar.bz2 caelestia-shell-5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52.zip | |
controlcenter: network and audio panels
Diffstat (limited to 'services')
| -rw-r--r-- | services/Network.qml | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/services/Network.qml b/services/Network.qml index 2c31065..f2c403e 100644 --- a/services/Network.qml +++ b/services/Network.qml @@ -27,13 +27,20 @@ Singleton { } function connectToNetwork(ssid: string, password: string): void { - // TODO: Implement password - connectProc.exec(["nmcli", "conn", "up", ssid]); + // First try to connect to an existing connection + // If that fails, create a new connection + if (password && password.length > 0) { + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid, "password", password]); + } else { + // Try to connect to existing connection first + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid]); + } } function disconnectFromNetwork(): void { if (active) { - disconnectProc.exec(["nmcli", "connection", "down", active.ssid]); + // Find the device name first, then disconnect + disconnectProc.exec(["nmcli", "device", "disconnect", "wifi"]); } } @@ -86,6 +93,10 @@ Singleton { Process { id: connectProc + onExited: { + // Refresh network list after connection attempt + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } @@ -97,6 +108,10 @@ Singleton { Process { id: disconnectProc + onExited: { + // Refresh network list after disconnection + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } |