Skip to content

Instantly share code, notes, and snippets.

@statico
Created February 28, 2022 17:36
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 statico/059b52b34ae9aa1c7fffd25501a73970 to your computer and use it in GitHub Desktop.
Save statico/059b52b34ae9aa1c7fffd25501a73970 to your computer and use it in GitHub Desktop.
ian's xbar icon
#!/usr/bin/env bash
export PATH="$HOME/bin:$PATH"
iface="$(route get 1.1.1.1 2>/dev/null | grep interface | perl -ple 's/\s*interface:\s*//')"
if [ $? != 0 ]; then
iface="n/a"
fi
case "$iface" in
en0)
menu="🍌 Wi-Fi"
;;
en3|en4|en5)
menu="🍉 Eth"
;;
utun4)
menu="🍒 VPN"
;;
*)
menu="🌽 $iface"
;;
esac
echo "$menu"
echo "---"
echo "sindent | shell=$HOME/bin/sindent"
echo "escape quotes | shell=$HOME/bin/escquotes"
echo "unixtime | shell=$HOME/bin/unixtime"
echo "---"
[ -e /tmp/p ] && cat /tmp/p | sed -e 's/$/ | shell=open param1=-a param2=MacVim param3=\/tmp\/p/' || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment