Use dynnetwork plugin in xmobar instead of network.