Skip to content

Instantly share code, notes, and snippets.

@statico
Created February 28, 2022 17:36
Embed
What would you like to do?
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