dwm-bar for archlinux
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.

21 lines
596 B

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