From 88d959b959e4e7e05755b7f340829e4241c625b8 Mon Sep 17 00:00:00 2001 From: awy Date: Wed, 14 Aug 2024 22:51:37 +0300 Subject: vpn --- .config/waybar/config | 8 +++++--- .config/waybar/scripts/vpn-toggle | 8 ++++++++ .config/waybar/style.css | 25 +++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100755 .config/waybar/scripts/vpn-toggle diff --git a/.config/waybar/config b/.config/waybar/config index cf404ff..c4dca4d 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -5,7 +5,7 @@ "reload_style_on_change": true, "modules-left": ["hyprland/workspaces","custom/separator","hyprland/window"], "modules-center": [], - "modules-right": ["custom/pacman", "custom/weather","memory","temperature", "custom/separator", "image", "pulseaudio","wireplumber", "custom/separator", "clock","tray"], + "modules-right": ["network", "custom/weather","memory", "custom/separator", "image", "pulseaudio","wireplumber", "custom/separator", "clock","tray"], "hyprland/window": { "format": "{}", @@ -36,9 +36,11 @@ }, }, "network": { + "interface": "wg0", "tooltip": false, - "interval": 5, - "format": "󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", + "format": "VPN", + "format-disconnected": "VPN", + "on-click": "~/.config/waybar/scripts/vpn-toggle", }, "tray": { "spacing": 10 diff --git a/.config/waybar/scripts/vpn-toggle b/.config/waybar/scripts/vpn-toggle new file mode 100755 index 0000000..4b48203 --- /dev/null +++ b/.config/waybar/scripts/vpn-toggle @@ -0,0 +1,8 @@ +#!/bin/sh +if [ -d /sys/class/net/wg0 ]; then + doas wg-quick down wg0 + hyprctl notify 5 5000 "rgb(ff0000)" " VPN is disabled" +else + doas wg-quick up wg0 + hyprctl notify 5 5000 "rgb(008000)" " VPN is enabled" +fi diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 0d12a29..017b1cf 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -63,8 +63,29 @@ tooltip { } #network { - margin-left: 15px; - color: @blue; + margin-right: 5px; + color: @green; + border: 1px; + border-style: solid; + border-color: rgba(100,100,100,0.5); + background: rgba(0, 0, 0,0.3); + margin-top: 8px; + margin-bottom: 8px; + border-radius: 8px; + padding: 8px; +} + +#network.disconnected { + margin-right: 5px; + color: @red; + border: 1px; + border-style: solid; + border-color: rgba(100,100,100,0.5); + background: rgba(0, 0, 0,0.3); + margin-top: 8px; + margin-bottom: 8px; + border-radius: 8px; + padding: 8px; } #custom-weather { -- cgit v1.2.3