summaryrefslogtreecommitdiff
path: root/scripts/wifi-menu-custom
diff options
context:
space:
mode:
authorjustsaumit <justsaumit@draconyan.xyz>2022-03-01 19:54:04 +0530
committerjustsaumit <justsaumit@draconyan.xyz>2022-03-01 19:54:04 +0530
commit98bbe7bd7fcec209e2408ff0b086858715ca89e0 (patch)
treed7597d75bbcc7d2b9621693c89058b77c8d504b2 /scripts/wifi-menu-custom
parent588af889ea41d9dfeb7f2c47c1a7af4de65b4406 (diff)
updated
Diffstat (limited to 'scripts/wifi-menu-custom')
-rwxr-xr-xscripts/wifi-menu-custom22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/wifi-menu-custom b/scripts/wifi-menu-custom
new file mode 100755
index 0000000..db2fced
--- /dev/null
+++ b/scripts/wifi-menu-custom
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+choice=$(echo -e "up\ndown\nconnect" | dmenu -p "Do you wish to connect to a wi-fi or disconnect?:")
+
+case $choice in
+ "connect")
+ bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | dmenu -p "Select Wifi  " -l 20 | cut -d' ' -f1)
+ pass=$(echo "" | dmenu -p "Enter Pswd  ")
+ nmcli device wifi $choice $bssid password $pass;;
+ "up" | "down")
+ ssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | dmenu -p "Select Wifi  " -l 20 | cut -d' ' -f3)
+ nmcli c $choice $ssid;;
+esac
+wifistatus=$(nmcli d | grep wlan0 | cut -d ' ' -f10)
+case $wifistatus in
+ "connected")
+ nmcli con down eth0 "Wired connection 1";;
+ "disconnected")
+ nmcli con up eth0 "Wired connection 1";;
+esac
+ethstatus=$(nmcli d | grep eth0 | cut -d ' ' -f7)
+notify-send "Ethernet connection is $ethstatus"