New backup 2025-03-12 19:15:01
This commit is contained in:
parent
45b0b41e50
commit
1d642f6480
2 changed files with 31 additions and 10 deletions
|
@ -1,9 +1,10 @@
|
|||
(defpoll wireless_active :initial false
|
||||
:interval "60s"
|
||||
"scripts/bar/network-status wireless")
|
||||
(defpoll wired_active :initial false
|
||||
:interval "60s"
|
||||
"scripts/bar/network-status ethernet")
|
||||
(deflisten network_status "scripts/bar/networking")
|
||||
;(defpoll wireless_active :initial false
|
||||
; :interval "60s"
|
||||
; "scripts/bar/network-status wireless")
|
||||
;(defpoll wired_active :initial false
|
||||
; :interval "60s"
|
||||
; "scripts/bar/network-status ethernet")
|
||||
(defvar reveal_network false)
|
||||
(defwidget network []
|
||||
(revealer-on-hover
|
||||
|
@ -11,7 +12,7 @@
|
|||
:revealvar-name "reveal_network"
|
||||
(button :onclick 'nm-connection-editor'
|
||||
:class {wireless_active || wired_active ? "active" : ""}
|
||||
"")
|
||||
"${network_status.wired}")
|
||||
(network_children)))
|
||||
|
||||
(defwidget network_children []
|
||||
|
|
|
@ -1,13 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
function ifstatus(){
|
||||
echo $1
|
||||
echo $2
|
||||
is_wireless=false
|
||||
is_ethernet=false
|
||||
is_proton=false
|
||||
is_homevpn=false
|
||||
|
||||
if nmcli -g TYPE connection show --active | grep -q "wireless";then
|
||||
is_wireless='true'
|
||||
fi
|
||||
if nmcli -g TYPE connection show --active | grep -q "ethernet";then
|
||||
is_ethernet='true'
|
||||
fi
|
||||
if nmcli -g TYPE,NAME connection show --active | grep -e "vpn" -e "wireguard" | grep -qi "proton";then
|
||||
is_proton='true'
|
||||
fi
|
||||
if nmcli -g TYPE,NAME connection show --active | grep -e "vpn" -e "wireguard" | grep -qi "home";then
|
||||
is_homevpn='true'
|
||||
fi
|
||||
|
||||
echo $(jq -n --arg wifi "${is_wireless}" --arg wired "${is_ethernet}" --arg proton "${is_proton}" --arg homevpn "${is_homevpn}" '{wifi: $wifi, wired: $wired, proton: $proton, homevpn: $homevpn}')
|
||||
}
|
||||
|
||||
ifstatus
|
||||
|
||||
ip monitor address | {
|
||||
while read -r event; do
|
||||
# echo hi ${event};
|
||||
ifstatus "${1}" "${event}"
|
||||
ifstatus
|
||||
done;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue