polybar and wireguard utilities addition.
This commit is contained in:
17
bin/wgX.sh
Executable file
17
bin/wgX.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
verb=$1
|
||||||
|
|
||||||
|
iface=$(basename $0)
|
||||||
|
|
||||||
|
if [ -z "$verb" ]; then
|
||||||
|
verb=status;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$verb" = "up" ] || [ "$verb" = "down" ]; then
|
||||||
|
sudo wg-quick $verb /etc/wireguard/${iface}.conf;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$verb" = "status" ] || [ "$verb" = "start" ] || [ "$verb" = "stop" ]; then
|
||||||
|
sudo systemctl $verb wg-quick@${iface}.service;
|
||||||
|
fi
|
||||||
@@ -63,7 +63,7 @@ font-6 = siji:pixelsize=9;1
|
|||||||
modules-left = bspwm i3 xwindow
|
modules-left = bspwm i3 xwindow
|
||||||
;modules-left = i3
|
;modules-left = i3
|
||||||
modules-center = mpd
|
modules-center = mpd
|
||||||
modules-right = filesystem backlight volume xkeyboard memory cpu eth wlan wg0 wg1 temperature battery date powermenu
|
modules-right = filesystem backlight volume xkeyboard memory cpu eth wlan wg temperature battery date powermenu
|
||||||
|
|
||||||
tray-position = right
|
tray-position = right
|
||||||
tray-padding = 2
|
tray-padding = 2
|
||||||
@@ -134,9 +134,10 @@ interval = 25
|
|||||||
|
|
||||||
mount-0 = /
|
mount-0 = /
|
||||||
mount-1 = /home
|
mount-1 = /home
|
||||||
mount-2 = /home/renato/cloud.renatorosa.com
|
#mount-2 = /media/renato/cloud.renatorosa.com
|
||||||
mount-3 = /home/renato/drive.silveirarosa.com
|
#mount-3 = /media/renato/cloud.silveirarosa.com
|
||||||
|
|
||||||
|
#label-mounted = %fsname%:%{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
|
||||||
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
|
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
|
||||||
label-unmounted = (N/A)
|
label-unmounted = (N/A)
|
||||||
label-unmounted-foreground = ${colors.foreground-alt}
|
label-unmounted-foreground = ${colors.foreground-alt}
|
||||||
@@ -372,6 +373,13 @@ format-disconnected-underline = ${self.format-connected-underline}
|
|||||||
label-disconnected = %ifname%
|
label-disconnected = %ifname%
|
||||||
label-disconnected-foreground = ${colors.foreground-alt}
|
label-disconnected-foreground = ${colors.foreground-alt}
|
||||||
|
|
||||||
|
[module/wg]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/src/sysadmin/polybar/wg.sh
|
||||||
|
interval = 5
|
||||||
|
# tail = true
|
||||||
|
|
||||||
|
|
||||||
[module/wg0]
|
[module/wg0]
|
||||||
inherit = module/eth
|
inherit = module/eth
|
||||||
interface = wg0
|
interface = wg0
|
||||||
@@ -520,6 +528,10 @@ animation-charging-2 =
|
|||||||
animation-charging-foreground = ${colors.foreground-alt}
|
animation-charging-foreground = ${colors.foreground-alt}
|
||||||
animation-charging-framerate = 750
|
animation-charging-framerate = 750
|
||||||
|
|
||||||
|
label-charging = %percentage%% (%time%)
|
||||||
|
label-discharging = %percentage%% (%time%)
|
||||||
|
label-full = FULL
|
||||||
|
|
||||||
[module/battery-alt]
|
[module/battery-alt]
|
||||||
type = internal/battery
|
type = internal/battery
|
||||||
battery = BAT0
|
battery = BAT0
|
||||||
|
|||||||
16
polybar/wg.sh
Executable file
16
polybar/wg.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#printf "wg:" && (pgrep -a $(sudo wg)$ | head -n 1 | awk '{print $NF'} | cut -d '.' -f 1 && echo down) | head -n 1
|
||||||
|
|
||||||
|
wg=$(sudo wg);
|
||||||
|
|
||||||
|
if [ -z "$wg" ]; then
|
||||||
|
echo "(down)";
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
handshake=$(echo "$wg" | grep handshake | cut -d ':' -f 2 | sed 's/minutes/min/' | sed 's/seconds/sec/');
|
||||||
|
|
||||||
|
transfer=$(echo "$wg" | grep transfer | cut -d ':' -f 2 | sed 's/sent/UL/' | sed 's/received,/DL/' | sed 's/iB//g') ;
|
||||||
|
|
||||||
|
printf "wg:$transfer($handshake)";
|
||||||
Reference in New Issue
Block a user