File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ source $current_dir/utils.sh
77
88# set your own hosts so that a wifi is recognised even without internet access
99HOSTS=$( get_tmux_option " @dracula-network-hosts" " google.com github.com example.com" )
10+ wifi_label=$( get_tmux_option " @dracula-network-wifi-label" " " )
11+ ethernet_label=$( get_tmux_option " @dracula-network-ethernet-label" " Ethernet" )
1012
1113get_ssid ()
1214{
@@ -15,18 +17,17 @@ get_ssid()
1517 Linux)
1618 SSID=$( iw dev | sed -nr ' s/^\t\tssid (.*)/\1/p' )
1719 if [ -n " $SSID " ]; then
18- printf ' %s ' " $wifi_label$SSID "
20+ echo " $wifi_label$SSID "
1921 else
20- echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet " ) "
22+ echo " $ethernet_label "
2123 fi
2224 ;;
2325
2426 Darwin)
2527 if networksetup -getairportnetwork en0 | cut -d ' :' -f 2 | sed ' s/^[[:blank:]]*//g' & > /dev/null; then
26- wifi_label=$( get_tmux_option " @dracula-network-wifi-label" " " )
2728 echo " $wifi_label $( networksetup -getairportnetwork en0 | cut -d ' :' -f 2) " | sed ' s/^[[:blank:]]*//g'
2829 else
29- echo " $( get_tmux_option " @dracula-network-ethernet-label " " Ethernet " ) "
30+ echo " $ethernet_label "
3031 fi
3132 ;;
3233
4445{
4546 network=" $( get_tmux_option " @dracula-network-offline-label" " Offline" ) "
4647 for host in $HOSTS ; do
47- if ping -q -c 1 -W 1 $host & > /dev/null; then
48+ if ping -q -c 1 -W 1 " $host " & > /dev/null; then
4849 network=" $( get_ssid) "
4950 break
5051 fi
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33get_tmux_option () {
4- local option=$1
5- local default_value=$2
6- local option_value=$( tmux show-option -gqv " $option " )
4+ local option=" $1 "
5+ local default_value=" $2 "
6+ local option_value=" $( tmux show-option -gqv " $option " ) "
77 if [ -z " $option_value " ]; then
8- echo $default_value
8+ echo " $default_value "
99 else
10- echo $option_value
10+ echo " $option_value "
1111 fi
1212}
1313
1414get_tmux_window_option () {
15- local option=$1
16- local default_value=$2
17- local option_value=$( tmux show-window-options -v " $option " )
15+ local option=" $1 "
16+ local default_value=" $2 "
17+ local option_value=" $( tmux show-window-options -v " $option " ) "
1818 if [ -z " $option_value " ]; then
19- echo $default_value
19+ echo " $default_value "
2020 else
21- echo $option_value
21+ echo " $option_value "
2222 fi
2323}
2424
You can’t perform that action at this time.
0 commit comments