Clean up some unneeded variables
This commit is contained in:
parent
d1907bfda4
commit
43da6f9a4a
|
@ -18,10 +18,6 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
|
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
|
||||||
# For some reason wofi always approximates character width 2 short... hmmm
|
|
||||||
RWIDTH=$(($(echo "$LIST" | head -n 1 | awk '{print length($0); }')*10))
|
|
||||||
# Dynamically change the height of the wofi menu
|
|
||||||
LINENUM=$(echo "$LIST" | wc -l)
|
|
||||||
# Gives a list of known connections so we can parse it later
|
# Gives a list of known connections so we can parse it later
|
||||||
KNOWNCON=$(nmcli connection show)
|
KNOWNCON=$(nmcli connection show)
|
||||||
# Really janky way of telling if there is currently a connection
|
# Really janky way of telling if there is currently a connection
|
||||||
|
@ -33,22 +29,12 @@ if [[ ! -z $CURRSSID ]]; then
|
||||||
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
|
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# HOPEFULLY you won't need this as often as I do
|
|
||||||
# If there are more than 8 SSIDs, the menu will still only have 8 lines
|
|
||||||
if [ "$LINENUM" -gt 8 ] && [[ "$CONSTATE" =~ "enabled" ]]; then
|
|
||||||
LINENUM=8
|
|
||||||
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
|
||||||
LINENUM=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$CONSTATE" =~ "enabled" ]]; then
|
if [[ "$CONSTATE" =~ "enabled" ]]; then
|
||||||
TOGGLE="toggle off"
|
TOGGLE="toggle off"
|
||||||
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
||||||
TOGGLE="toggle on"
|
TOGGLE="toggle on"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | wofi -s $HOME/.dotfiles/wofi/style.css -i -d --prompt "Wi-Fi SSID: " -c $HOME/.dotfiles/wofi/sidebar)
|
CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | wofi -s $HOME/.dotfiles/wofi/style.css -i -d --prompt "Wi-Fi SSID: " -c $HOME/.dotfiles/wofi/sidebar)
|
||||||
if [[ $CHENTRY == "" ]]; then
|
if [[ $CHENTRY == "" ]]; then
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in New Issue