all repos — quickshell @ 85e31b0fda1b88a16553c75958e7c13ee9c0ed4f

A desert-witch desktop shell

bar/scripts/network.sh.old (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
#!/usr/bin/env bash

# Find the first wireless interface
is_ethernet=$(nmcli device status | grep ethernet && true || false)
connection_type=$(iw dev | awk '$1=="Interface"{print $2; exit}') #gets network type (wired/wifi)
network_name=$(iw dev $connection_type link | awk -F': ' '/^\s*SSID:/ {print $2}')
signal_strength=$(iw dev $connection_type link | awk '/signal:/ {print $2}')
if [ is ethernet ]; then
    echo -n 100 ethernet $network_name
else
    if [ -n $signal_strength ]; then
        echo -n "$signal_strength"+"$network_name"
    fi
fi