Configuration file for dwm-bar on macbook air
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
797 B

  1. #!/bin/sh
  2. # A dwm_bar function to show the current network connection/SSID, private IP, and public IP using NetworkManager
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. # Dependencies: NetworkManager, curl
  6. dwm_networkmanager () {
  7. CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}')
  8. if [ "$CONNAME" = "" ]; then
  9. CONNAME=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -c 5-)
  10. fi
  11. PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}')
  12. PUBLIC=$(curl -s https://ipinfo.io/ip)
  13. printf "%s" "$SEP1"
  14. if [ "$IDENTIFIER" = "unicode" ]; then
  15. printf "🌐 %s %s | %s" "$CONNAME" "$PRIVATE" "$PUBLIC"
  16. else
  17. printf "NET %s %s | %s" "$CONNAME" "$PRIVATE" "$PUBLIC"
  18. fi
  19. printf "%s\n" "$SEP2"
  20. }
  21. dwm_networkmanager