File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 22# setting the locale, some users have issues with different locales, this forces the correct one
33export LC_ALL=en_US.UTF-8
44
5- HOSTS=" google.com github.com example.com"
5+ current_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
6+ source $current_dir /utils.sh
7+
8+ # set your own hosts so that a wifi is recognised even without internet access
9+ HOSTS=$( get_tmux_option " @dracula-network-hosts" " google.com github.com example.com" )
610
711get_ssid ()
812{
@@ -11,17 +15,18 @@ get_ssid()
1115 Linux)
1216 SSID=$( iw dev | sed -nr ' s/^\t\tssid (.*)/\1/p' )
1317 if [ -n " $SSID " ]; then
14- printf ' %s' " $SSID "
18+ printf ' %s' " $wifi_label$ SSID "
1519 else
16- echo ' Ethernet'
20+ echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet" ) "
1721 fi
1822 ;;
1923
2024 Darwin)
2125 if networksetup -getairportnetwork en0 | cut -d ' :' -f 2 | sed ' s/^[[:blank:]]*//g' & > /dev/null; then
22- echo " $( networksetup -getairportnetwork en0 | cut -d ' :' -f 2) " | sed ' s/^[[:blank:]]*//g'
26+ wifi_label=$( get_tmux_option " @dracula-network-wifi-label" " " )
27+ echo " $wifi_label $( networksetup -getairportnetwork en0 | cut -d ' :' -f 2) " | sed ' s/^[[:blank:]]*//g'
2328 else
24- echo ' Ethernet'
29+ echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet" ) "
2530 fi
2631 ;;
2732
@@ -37,7 +42,7 @@ get_ssid()
3742
3843main ()
3944{
40- network=" Offline"
45+ network=" $( get_tmux_option " @dracula-network-offline-label " " Offline" ) "
4146 for host in $HOSTS ; do
4247 if ping -q -c 1 -W 1 $host & > /dev/null; then
4348 network=" $( get_ssid) "
You can’t perform that action at this time.
0 commit comments