dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | #!/usr/bin/env bash |
| 2 | # Network state as one line of JSON for the Eww control center. Wired wins over |
| 3 | # Wi-Fi when both are up. |
| 4 | ICON_WIRED=$'\U000F0200' # nf-md-ethernet |
| 5 | ICON_WIFI=$'\U000F05A9' # nf-md-wifi |
| 6 | ICON_OFF=$'\U000F0202' # nf-md-ethernet_off |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | || { ; ; } |
| 13 | networking= || { ; ; } |
| 14 | [ || { ; ; } |
| 15 | |
| 16 | # DEVICE:TYPE:STATE:CONNECTION |
| 17 | devices= |
| 18 | wired= |
| 19 | # eno1 is set up by systemd-networkd (hosts/desktop), so NetworkManager only |
| 20 | # sees it as unmanaged; it counts as connected when the link is up. |
| 21 | if [; then |
| 22 | while ; do |
| 23 | [ && { wired=; break; } |
| 24 | done |
| 25 | fi |
| 26 | wifi= |
| 27 | |
| 28 | if [; then |
| 29 | dev= |
| 30 | speed= |
| 31 | label="Wired" |
| 32 | if [ ; then |
| 33 | label+=" · Gb/s" |
| 34 | elif [ ; then |
| 35 | label+=" · Mb/s" |
| 36 | fi |
| 37 | |
| 38 | elif [; then |
| 39 | name= |
| 40 | |
| 41 | else |
| 42 | |
| 43 | fi |