New backup 2025-03-12 19:30:02

This commit is contained in:
Penelope Gwen 2025-03-12 19:30:02 -07:00
parent 1d642f6480
commit ba1a133294
6 changed files with 47 additions and 32 deletions

View file

@ -71,6 +71,7 @@
;rightgroup
(include "modules/bar/idle_inhibit.yuck")
(include "modules/bar/volume.yuck")
(include "variables/bar/network.yuck")
(include "modules/bar/network.yuck")
(include "modules/bar/vpn.yuck")
(include "modules/bar/bluetooth.yuck")

View file

@ -1,18 +1,11 @@
(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
:revealvar reveal_network
:revealvar-name "reveal_network"
(button :onclick 'nm-connection-editor'
:class {wireless_active || wired_active ? "active" : ""}
"${network_status.wired}")
:class {network_status.wifi || network_status.wired ? "active" : ""}
"")
(network_children)))
(defwidget network_children []
@ -20,9 +13,9 @@
:orientation "h"
:space-evenly false
:halign "center"
(button :onclick {wireless_active ? 'scripts/bar/network-updown wifi down' : 'scripts/network-updown wifi up'}
:class {wireless_active ? "active" : ""}
(button :onclick {network_status.wifi ? 'scripts/bar/network-updown wifi down' : 'scripts/bar/network-updown wifi up'}
:class {network_status.wifi ? "active" : ""}
"")
(button :onclick {wired_active ? 'scripts/bar/network-updown ethernet down' : 'scripts/network-updown ethernet up'}
:class {wired_active ? "active" : ""}
(button :onclick {network_status.wired ? 'scripts/bar/network-updown ethernet down' : 'scripts/bar/network-updown ethernet up'}
:class {network_status.wired ? "active" : ""}
"🖧")))

View file

@ -1,33 +1,21 @@
(defpoll vpn_active :initial false
:interval "60s"
"scripts/bar/vpn-status")
(defvar reveal_vpn false)
(defwidget vpn []
(revealer-on-hover
:revealvar reveal_vpn
:revealvar-name "reveal_vpn"
(button :onclick 'notify-send "test"'
:class {vpn_active ? "active" : ""}
{vpn_active ? "" : ""})
:class {network_status.proton || network_status.homevpn ? "active" : ""}
{network_status.proton || network_status.homevpn ? "" : ""})
(vpn_children)))
(defpoll home_vpn_active :initial false
:interval "60s"
"scripts/bar/vpn-status Home")
(defpoll proton_vpn_active :initial false
:interval "60s"
"scripts/bar/vpn-status Proton")
(defwidget vpn_children []
(box :class "reveal_children"
:orientation "h"
:space-evenly false
:halign "center"
(button :onclick 'scripts/bar/nmcli-vpn "HomeVPN"'
:class {home_vpn_active ? "active" : ""}
{home_vpn_active ? "" : ""})
:class {network_status.homevpn ? "active" : ""}
{network_status.homevpn ? "" : ""})
(button :onclick 'scripts/bar/nmcli-vpn "Proton SE-NL"'
:class {proton_vpn_active ? "active" : ""}
{proton_vpn_active ? "" : ""})))
:class {network_status.proton ? "active" : ""}
{network_status.proton ? "" : ""})))

View file

@ -0,0 +1,33 @@
#!/bin/bash
function ifstatus(){
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
done;
}

View file

@ -19,7 +19,6 @@ function ifstatus(){
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}')
}

View file

@ -0,0 +1 @@
(deflisten network_status "scripts/bar/networking")