wireguard -> polybar etc.

This commit is contained in:
Harri Lahtinen 2020-05-13 18:14:45 +03:00
parent 601277609f
commit faaf205da7
4 changed files with 53 additions and 5 deletions

View File

@ -75,7 +75,7 @@ exec --no-startup-id twmnd &
#Wpgtk
exec --no-startup-id ~/.config/wpg/wp_init.sh
#Battery notify
exec --no-startup-id ~/.config/Scripts/i3-battery-monitor
exec --no-startup-id ~/.config/Scripts/i3-battery-monitor &
#Conky
#exec --no-startup-id conky -d -c ~/.config/conky/conkybg &
#Picom

View File

@ -11,7 +11,7 @@ monitor = ${env:MONITOR:eDP-1}
include-file = ~/.config/polybar/top-bar
modules-left = i3 arrow01 xwindow arrow0
modules-center = term chrome editor fm music vpn
modules-right = arrow10 redshift arrow9 vpn-nordvpn-status arrow7 wlan arrow6 pkg arrow5 pavolume arrow4 battery arrow3 backlight arrow2 networkmanager arrow1 popup-calendar
modules-right = arrow10 redshift arrow9 vpn-wireguard-wg arrow8 vpn-nordvpn-status arrow7 wlan arrow6 pkg arrow5 pavolume arrow4 battery arrow3 backlight arrow2 networkmanager arrow1 popup-calendar
;tray-position = right
;tray-padding = 2
@ -101,13 +101,13 @@ content-background = ${colors.color3}
[module/arrow8]
type = custom/text
content = ""
content-foreground = ${colors.color2}
content-background = ${colors.color3}
content-foreground = ${colors.color3}
content-background = ${colors.color4}
[module/arrow9]
type = custom/text
content = ""
content-foreground = ${colors.color3}
content-foreground = ${colors.color4}
content-background = ${colors.color6}
[module/arrow10]
@ -219,6 +219,14 @@ label = "%output% "
label-foreground = ${colors.color0}
label-background = ${colors.color9}
[module/vpn-wireguard-wg]
type = custom/script
exec = ~/.config/polybar/scripts/wireguard/vpn-wireguard-wg.sh
interval = 5
click-left = ~/.config/polybar/scripts/wireguard/vpn-wireguard-wg.sh --toggle &
label-foreground = ${colors.color0}
label-background = ${colors.color4}
[module/temperature]
type = internal/temperature
thermal-zone = 6

View File

@ -0,0 +1,37 @@
#!/bin/sh
connection_status() {
if [ -f "$config" ]; then
connection=$(sudo wg show "$config_name" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config_name" ]; then
echo "1"
else
echo "2"
fi
else
echo "3"
fi
}
config="$HOME/wg/wg0.conf"
config_name=$(basename "${config%.*}")
case "$1" in
--toggle)
if [ "$(connection_status)" = "1" ]; then
sudo wg-quick down "$config" 2>/dev/null
else
sudo wg-quick up "$config" 2>/dev/null
fi
;;
*)
if [ "$(connection_status)" = "1" ]; then
echo " WG up"
elif [ "$(connection_status)" = "3" ]; then
echo "#3 Config not found!"
else
echo " WG down"
fi
;;
esac

View File

@ -64,6 +64,7 @@ inetutils
intel-media-driver
intel-ucode
iproute2
ipset
iputils
iwd
jfsutils
@ -102,6 +103,7 @@ ncmpcpp
neofetch
neovim
netctl
network-manager-applet
networkmanager
networkmanager-openvpn
newsboat
@ -177,6 +179,7 @@ vulkan-intel
w3m
wget
which
wireguard-tools
wireless_tools
wpa_supplicant
xcursor-vanilla-dmz