File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 2
2
# setting the locale, some users have issues with different locales, this forces the correct one
3
3
export LC_ALL=en_US.UTF-8
4
4
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" )
6
10
7
11
get_ssid ()
8
12
{
@@ -11,17 +15,18 @@ get_ssid()
11
15
Linux)
12
16
SSID=$( iw dev | sed -nr ' s/^\t\tssid (.*)/\1/p' )
13
17
if [ -n " $SSID " ]; then
14
- printf ' %s' " $SSID "
18
+ printf ' %s' " $wifi_label$ SSID "
15
19
else
16
- echo ' Ethernet'
20
+ echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet" ) "
17
21
fi
18
22
;;
19
23
20
24
Darwin)
21
25
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'
23
28
else
24
- echo ' Ethernet'
29
+ echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet" ) "
25
30
fi
26
31
;;
27
32
@@ -37,7 +42,7 @@ get_ssid()
37
42
38
43
main ()
39
44
{
40
- network=" Offline"
45
+ network=" $( get_tmux_option " @dracula-network-offline-label " " Offline" ) "
41
46
for host in $HOSTS ; do
42
47
if ping -q -c 1 -W 1 $host & > /dev/null; then
43
48
network=" $( get_ssid) "
You can’t perform that action at this time.
0 commit comments