Add i3bar fields for OpenVPN.
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
separator_block_width=33
|
||||
|
||||
[vpn-main]
|
||||
command=$HOME/.i3/scripts/openvpn main
|
||||
label=
|
||||
interval=120
|
||||
|
||||
[vpn-mgmt]
|
||||
command=$HOME/.i3/scripts/openvpn mgmt
|
||||
label=
|
||||
interval=120
|
||||
|
||||
[wifi]
|
||||
command=$HOME/.i3/scripts/wifi
|
||||
label=
|
||||
@@ -11,9 +21,9 @@ label=
|
||||
interval=120
|
||||
|
||||
[load]
|
||||
command=/usr/lib/i3blocks/load_average
|
||||
command=$HOME/.i3/scripts/load
|
||||
label=
|
||||
interval=120
|
||||
interval=30
|
||||
|
||||
[volume]
|
||||
command=$HOME/.i3/scripts/pa-volume status
|
||||
|
||||
17
i3/i3/scripts/load
Executable file
17
i3/i3/scripts/load
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
load="$(cut -d ' ' -f 2 /proc/loadavg)"
|
||||
cpus="$(nproc --all)"
|
||||
|
||||
echo $load
|
||||
echo $load
|
||||
|
||||
awk -v cpus=$cpus -v _load=$load '
|
||||
BEGIN {
|
||||
if (_load >= cpus) {
|
||||
print "#FF0000";
|
||||
}
|
||||
else if (_load >= cpus / 2) {
|
||||
print "#FFFF00";
|
||||
}
|
||||
}'
|
||||
20
i3/i3/scripts/openvpn
Executable file
20
i3/i3/scripts/openvpn
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
[[ "$1" ]] || exit 1
|
||||
name="$1"
|
||||
|
||||
pidfile="/run/openvpn@client-${name}.pid"
|
||||
|
||||
if pgrep --pidfile "${pidfile}" >/dev/null 2>&1 ; then
|
||||
status="UP"
|
||||
color="#ffffff"
|
||||
else
|
||||
status="DOWN"
|
||||
color="#ff0000"
|
||||
fi
|
||||
|
||||
output="${name} ${status}"
|
||||
|
||||
echo $output
|
||||
echo $output
|
||||
echo $color
|
||||
@@ -5,7 +5,7 @@ aps="$(nmcli --terse --fields IN-USE,SSID,SIGNAL device wifi list | grep '^\*:')
|
||||
ssid="$(echo $aps | cut -d ':' -f 2)"
|
||||
perc="$(echo $aps | cut -d ':' -f 3)"
|
||||
|
||||
output="$ssid $perc%"
|
||||
output="$ssid $perc%"
|
||||
|
||||
echo $output
|
||||
echo $output
|
||||
echo "$output"
|
||||
echo "$output"
|
||||
|
||||
Reference in New Issue
Block a user