Skip to content

Instantly share code, notes, and snippets.

@jackinloadup
Created January 3, 2017 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackinloadup/08dd6e31d60fc051050e569f7f3891c7 to your computer and use it in GitHub Desktop.
Save jackinloadup/08dd6e31d60fc051050e569f7f3891c7 to your computer and use it in GitHub Desktop.
vpn i3block
#!/bin/sh
usage() { echo "Usage: $0 [-i enable icon]" 1>&2; exit 1; }
lock=" "
unlock=" "
icon=" " #rocket
text="VPN"
while getopts "d:i" o;
do
case "${o}" in
i)
char_enable=1
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
DIR="/var/run/vpnc/defaultroute"
if [ -a $DIR ]; then
if [[ ! -z "$char_enable" ]]; then
char=$icon
else
char=""
fi
echo "$char$text"
echo "$char$text"
echo "#34CD0F"
#exit 33 #sets as urgent. hard red background
case $BLOCK_BUTTON in
#right click will kill vpnc
3) sudo vpnc-disconnect ;;
esac
else
if [[ ! -z "$char_enable" ]]; then
char=$unlock
else
char=""
fi
echo "$text"
echo "$text"
echo "#FF0000"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment