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
|
(deflisten network_status "scripts/bar/networking")
|
||||||
:interval "60s"
|
;(defpoll wireless_active :initial false
|
||||||
"scripts/bar/network-status wireless")
|
; :interval "60s"
|
||||||
(defpoll wired_active :initial false
|
; "scripts/bar/network-status wireless")
|
||||||
:interval "60s"
|
;(defpoll wired_active :initial false
|
||||||
"scripts/bar/network-status ethernet")
|
; :interval "60s"
|
||||||
|
; "scripts/bar/network-status ethernet")
|
||||||
(defvar reveal_network false)
|
(defvar reveal_network false)
|
||||||
(defwidget network []
|
(defwidget network []
|
||||||
(revealer-on-hover
|
(revealer-on-hover
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
:revealvar-name "reveal_network"
|
:revealvar-name "reveal_network"
|
||||||
(button :onclick 'nm-connection-editor'
|
(button :onclick 'nm-connection-editor'
|
||||||
:class {wireless_active || wired_active ? "active" : ""}
|
:class {wireless_active || wired_active ? "active" : ""}
|
||||||
"")
|
"${network_status.wired}")
|
||||||
(network_children)))
|
(network_children)))
|
||||||
|
|
||||||
(defwidget network_children []
|
(defwidget network_children []
|
||||||
|
|
|
@ -1,13 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
function ifstatus(){
|
function ifstatus(){
|
||||||
echo $1
|
is_wireless=false
|
||||||
echo $2
|
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 | {
|
ip monitor address | {
|
||||||
while read -r event; do
|
while read -r event; do
|
||||||
# echo hi ${event};
|
# echo hi ${event};
|
||||||
ifstatus "${1}" "${event}"
|
ifstatus
|
||||||
done;
|
done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue