New backup 2026-01-03 14:15:02

This commit is contained in:
Penelope Gwen 2026-01-03 14:15:02 -08:00
parent 2b5e962b1a
commit 84513a7cc8
2 changed files with 18 additions and 10 deletions

View file

@ -7,16 +7,24 @@
(button :onclick 'nm-connection-editor'
:class "revealer-preview" ;${network_status.wifi || network_status.wired ? 'active' : 'inactive'}"
"󰇧")
(network_children)))
(network_children :array "${network_manager.interfaces}")))
(defwidget network_children []
(defwidget network_children [array]
(box :class "reveal-children"
:orientation "h"
:space-evenly false
:halign "center"
(button :onclick {network_status.wifi ? 'scripts/bar/network-updown wifi down' : 'scripts/bar/network-updown wifi up'}
:class {network_status.wifi ? "active" : "inactive"}
"")
(button :onclick {network_status.wired ? 'scripts/bar/network-updown ethernet down' : 'scripts/bar/network-updown ethernet up'}
:class {network_status.wired ? "active" : "inactive"}
"󰈀")))
(for interface in array
(button :onclick ""
{( interface.type == "wifi" ? "" : "eth" )}
)
)
)
)
; (button :onclick {network_status.wifi ? 'scripts/bar/network-updown wifi down' : 'scripts/bar/network-updown wifi up'}
; :class {network_status.wifi ? "active" : "inactive"}
; "")
; (button :onclick {network_status.wired ? 'scripts/bar/network-updown ethernet down' : 'scripts/bar/network-updown ethernet up'}
; :class {network_status.wired ? "active" : "inactive"}
; "󰈀")))

View file

@ -2,8 +2,8 @@
function ifstatus(){
jq -cs '.[0] * {"vpns": [(.[1].cons[] | select((.type=="vpn") or (.type=="wireguard")))]}' <<<$( \
nmcli --terse -f DEVICE,TYPE,STATE,CONNECTION d s | column -t -n 'devices' --table-columns device,type,state,connection -s ':' -J; \
jq -cs '{"interfaces": [(.[0].devs[] | select((.type=="wifi") or (.type=="ethernet")))]} * {"vpns": [(.[1].cons[] | select((.type=="vpn") or (.type=="wireguard")))]}' <<<$( \
nmcli --terse -f DEVICE,TYPE,STATE,CONNECTION d s | column -t -n 'devs' --table-columns device,type,state,connection -s ':' -J; \
nmcli --terse -f NAME,TYPE,ACTIVE,DEVICE c s | column -t -n 'cons' --table-columns name,type,active,device -s ':' -J)
# [ .devices[] | select((.type=="wifi") or (.type=="ethernet")) ]
}