From 0bc85afca0f863c62e2a0c44fe33f7236248ed5f Mon Sep 17 00:00:00 2001 From: Brieuc Dubois Date: Sat, 17 Feb 2024 14:31:00 +0100 Subject: [PATCH] VPN status --- root/home/bhasher/.config/waybar/config | 8 +++++++- root/home/bhasher/.config/waybar/scripts/vpn | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 root/home/bhasher/.config/waybar/scripts/vpn diff --git a/root/home/bhasher/.config/waybar/config b/root/home/bhasher/.config/waybar/config index 345acbc..9ebcaad 100644 --- a/root/home/bhasher/.config/waybar/config +++ b/root/home/bhasher/.config/waybar/config @@ -6,7 +6,7 @@ // Choose the order of the modules "modules-left": ["hyprland/workspaces"], "modules-center": ["hyprland/window"], - "modules-right": ["pulseaudio", "network", "custom/bandwidth", "cpu", "memory", "battery", "tray", "clock"], + "modules-right": ["pulseaudio", "custom/VPN", "network", "custom/bandwidth", "cpu", "memory", "battery", "tray", "clock"], "hyprland/workspaces": { "disable-scroll": true, "all-outputs": false, @@ -56,6 +56,12 @@ "custom/bandwidth": { "exec": "$HOME/.config/waybar/scripts/bandwidth" }, + "custom/VPN": { + "format": "{}", + "interval": 5, + "max-length": 20, + "exec": "$HOME/.config/waybar/scripts/vpn" + }, "pulseaudio": { //"scroll-step": 1, "format": "{volume}% {icon}", diff --git a/root/home/bhasher/.config/waybar/scripts/vpn b/root/home/bhasher/.config/waybar/scripts/vpn new file mode 100755 index 0000000..b3bb702 --- /dev/null +++ b/root/home/bhasher/.config/waybar/scripts/vpn @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# Check if wireguard VPN is active +if nmcli c show --active | grep -q wireguard; then + echo "" +# If not, check if the connection named "YapiBiche" is active +elif nmcli c show --active | grep -q "YapiBiche"; then + echo "" +# If neither is active, return "NO" +else + echo "" +fi