wifi update
This commit is contained in:
parent
4735d58b77
commit
35f8cdfba0
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [[ "$(nmcli radio wifi)" = "enabled" ]] ; then
|
||||
nmcli radio wifi off
|
||||
notify-send "Wifi is now" off
|
||||
else
|
||||
nmcli radio wifi on
|
||||
notify-send "Wifi is now" on
|
||||
wifi_chooser
|
||||
fi
|
36
wifi_chooser
36
wifi_chooser
@ -2,6 +2,32 @@
|
||||
# choose a wifi signal in range and try to connect to it
|
||||
|
||||
verb=0
|
||||
action=start
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
"-v")
|
||||
verb=1
|
||||
;;
|
||||
"stop")
|
||||
action=stop
|
||||
;;
|
||||
"start") ;;
|
||||
"") break ;;
|
||||
*)
|
||||
echo "Invalid parameter '$1'"
|
||||
break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# Remaining args are garbage
|
||||
if [ "$#" -ne 0 ] ; then
|
||||
echo "Usage: $0 [-v] [start|stop]"
|
||||
echo "-v verbose output"
|
||||
echo "start or stop the wifi"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
title="Wifi Selector"
|
||||
id=""
|
||||
@ -13,10 +39,18 @@ notify () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Stop the wifi if asked
|
||||
if [ "$action" == "stop" ] ; then
|
||||
nmcli radio wifi off
|
||||
notify "Wifi stopped"
|
||||
exit "$?"
|
||||
fi
|
||||
|
||||
# Else, start it if needed
|
||||
if ( nmcli radio wifi | grep disabled > /dev/null ) ; then
|
||||
notify "Turning on"
|
||||
nmcli radio wifi on
|
||||
sleep 1
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
notify "Scanning networks in range..."
|
||||
|
Loading…
Reference in New Issue
Block a user