all repos — quickshell @ a3116179c30884d900f13e47038371e94d6ebe72

A desert-witch desktop shell

bar/scripts/network.sh (view raw)

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

# Find the first wireless interface
connection_type=$(iw dev | awk '$1=="Interface"{print $2; exit}') #gets network type (wired/wifi)
if [ -n "$connection_type" ]; then
    network_name=$(iw dev wlp13s0 link | awk -F': ' '/^\s*SSID:/ {print $2}')
    signal_strength=$(iw dev wlp13s0 link | awk '/signal:/ {print $2}')
    if (( sig >= -50 )); then
        bars=4
        elif (( sig >= -60 )); then
            bars=3
        elif (( sig >= -70 )); then
            bars=2
        elif (( sig >= -80 )); then
            bars=1
        else
            bars=0
    fi
    echo "$bars"+"$network_name"
fi