Updated Bitbar script
This commit is contained in:
parent
bb28d26191
commit
907724b864
@ -13,6 +13,11 @@
|
|||||||
# <xbar.author.github>jessejoe</xbar.author.github>
|
# <xbar.author.github>jessejoe</xbar.author.github>
|
||||||
# <xbar.desc>Displays status of a VPN interface with option to connect/disconnect.</xbar.desc>
|
# <xbar.desc>Displays status of a VPN interface with option to connect/disconnect.</xbar.desc>
|
||||||
# <xbar.image>http://i.imgur.com/RkmptwO.png</xbar.image>
|
# <xbar.image>http://i.imgur.com/RkmptwO.png</xbar.image>
|
||||||
|
# <swiftbar.hideAbout>true</swiftbar.hideAbout>
|
||||||
|
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
|
||||||
|
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
|
||||||
|
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
|
||||||
|
# <swiftbar.hideSwiftBar>false</swiftbar.hideSwiftBar>
|
||||||
|
|
||||||
VPN_CONNECTED=""
|
VPN_CONNECTED=""
|
||||||
|
|
||||||
@ -34,6 +39,7 @@ function notify(){
|
|||||||
|
|
||||||
# Get location to this script from symlink
|
# Get location to this script from symlink
|
||||||
SCRIPT_LOCATION=$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))
|
SCRIPT_LOCATION=$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))
|
||||||
|
SCRIPT_NAME="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
|
||||||
LOG_FILE=/tmp/vpn.log
|
LOG_FILE=/tmp/vpn.log
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -59,6 +65,12 @@ case "$1" in
|
|||||||
until [ -z "$(eval "$VPN_CONNECTED")" ]; do sleep 1; done
|
until [ -z "$(eval "$VPN_CONNECTED")" ]; do sleep 1; done
|
||||||
notify "Disconnected"
|
notify "Disconnected"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
logs)
|
||||||
|
tail -n 200 -f $LOG_FILE
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$(eval "$VPN_CONNECTED")" ]; then
|
if [ -n "$(eval "$VPN_CONNECTED")" ]; then
|
||||||
@ -73,5 +85,11 @@ fi
|
|||||||
|
|
||||||
echo '---'
|
echo '---'
|
||||||
echo "Edit routes | iconName=folder-symbolic href='file://$SCRIPT_LOCATION/routes.txt' refresh=false"
|
echo "Edit routes | iconName=folder-symbolic href='file://$SCRIPT_LOCATION/routes.txt' refresh=false"
|
||||||
echo "Tail VPN log file | bash='tail -f $LOG_FILE -n 200' terminal=true refresh=false"
|
|
||||||
|
LOG_CMD="$SCRIPT_LOCATION/$SCRIPT_NAME"
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
LOG_CMD="$LOG_CMD logs"
|
||||||
|
fi
|
||||||
|
echo "Tail VPN log file | bash='$LOG_CMD' params='logs' terminal=true refresh=false"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
Loading…
Reference in New Issue
Block a user