From f04a5d8b82cf542c519d55cb9ced8b1aae4c0ef2 Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Sun, 15 Mar 2020 14:18:06 -0700 Subject: [PATCH] network ssid --- battery.sh | 2 +- dracula.tmux | 2 +- internet.sh | 15 --------------- network.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 17 deletions(-) delete mode 100755 internet.sh create mode 100755 network.sh diff --git a/battery.sh b/battery.sh index 699026f..c6ad825 100755 --- a/battery.sh +++ b/battery.sh @@ -16,7 +16,7 @@ battery_status() if [ $status = 'discharging' ]; then echo '' else - echo 'Charging ' + echo 'AC ' fi } diff --git a/dracula.tmux b/dracula.tmux index 462c984..914ee25 100755 --- a/dracula.tmux +++ b/dracula.tmux @@ -43,7 +43,7 @@ main() tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ☺ " tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #(~/.tmux/plugins/tmux-dracula/battery.sh) " - tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] tructus " + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #(~/.tmux/plugins/tmux-dracula/network.sh) " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat ~/.tmux/plugins/tmux-dracula/weather.txt) " tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) " diff --git a/internet.sh b/internet.sh deleted file mode 100755 index 9582dac..0000000 --- a/internet.sh +++ /dev/null @@ -1,15 +0,0 @@ -#/usr/bin/env bash - -#author: Dane Williams -#script for gathering internet connectivity info -#script is called in dracula.tmux program - - - -main() -{ - -} - -#run main driver function -main diff --git a/network.sh b/network.sh new file mode 100755 index 0000000..62c20f5 --- /dev/null +++ b/network.sh @@ -0,0 +1,27 @@ +#/usr/bin/env bash + +#author: Dane Williams +#script for gathering internet connectivity info +#script is called in dracula.tmux program + + +get_ssid() +{ + if /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}' &>/dev/null + /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}' + else + echo 'Ethernet' + fi +} + +main() +{ + if ping -q -c 1 -W 1 google.com &>/dev/null; then + echo "$(get_ssid)" + else + echo 'Offline' + fi +} + +#run main driver function +main