summaryrefslogtreecommitdiff
path: root/dwifi
diff options
context:
space:
mode:
Diffstat (limited to 'dwifi')
-rwxr-xr-xdwifi19
1 files changed, 19 insertions, 0 deletions
diff --git a/dwifi b/dwifi
new file mode 100755
index 0000000..1376c94
--- /dev/null
+++ b/dwifi
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Get available Wi-Fi networks (SSID only, unique)
+ssid=$(nmcli -t -f ssid dev wifi list |
+ sed '/^$/d' | sort -u |
+ dmenu -i -l 20 -p "Select Wi-Fi:")
+
+# Exit if nothing selected
+[ -z "$ssid" ] && exit 1
+
+# Ask for password (hidden input)
+password=$(printf "" | dmenu -P -p "Password for $ssid:")
+
+# Try to connect
+if nmcli dev wifi connect "$ssid" password "$password"; then
+ notify-send "Wi-Fi Connected" "Connected to $ssid"
+else
+ notify-send "Wi-Fi Failed" "Could not connect to $ssid"
+fi