30 lines
1.1 KiB
Text
30 lines
1.1 KiB
Text
(defvar reveal_vpn false)
|
|
(defwidget vpn []
|
|
(revealer-on-hover
|
|
:class "${reveal_vpn} vpn"
|
|
:revealvar reveal_vpn
|
|
:revealvar-name "reveal_vpn"
|
|
(button :onclick 'notify-send "TODO"'
|
|
:class "revealer-preview ${(jq(network_manager.vpns, '[ .[] | select(.active=="yes") ] | length') > 0 ? 'active' : 'inactive')}"
|
|
"${(jq(network_manager.vpns, '[ .[] | select(.active=="yes") ] | length') > 0 ? '' : '')}")
|
|
(vpn_children :array "${network_manager.vpns}")))
|
|
|
|
(defwidget vpn_children [array]
|
|
(box :class "reveal-children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(for vpn in array
|
|
(button :onclick "nmcli connection ${( vpn.active == 'yes' ? 'down' : 'up' )} ${vpn.device}"
|
|
:class {( vpn.active == "yes" ? 'active' : 'inactive' )}
|
|
:tooltip "${vpn.name}"
|
|
"${( vpn.name =~ '^[Hh]ome.*' ?
|
|
( vpn.name =~ '.*[Ff]ull.*' ? '' : '') :
|
|
( vpn.name =~ '^pia-.*' ?
|
|
( vpn.name =~ '.*sea.*' ? '' : '' ) :
|
|
'' )
|
|
)} ${( vpn.active == 'yes' ? '' : '' )}"
|
|
)
|
|
)
|
|
)
|
|
)
|