diff --git a/config/waybar/config b/config/waybar/config index 1401ae7..344801a 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -1,7 +1,7 @@ [ { "name": "thinkstation", - "layer": "bottom", + "layer": "bottom", "position": "top", "margin": 4, "output": "HDMI-A-3", @@ -25,7 +25,7 @@ "clock", "tray" ], - "sway/workspaces": { + "sway/workspaces": { "all-outputs": true }, "sway/mode": { @@ -146,10 +146,10 @@ "sway/mode", ], "modules-center": [ - "custom/clock", + "custom/clock", ], "modules-right": [ - "network#openvpn", + "custom/vpn", "network", "temperature", "cpu", @@ -159,11 +159,11 @@ "pulseaudio", "tray" ], - "custom/clock": { - "exec": "date +'%A %d/%m/%Y %H:%M'", - "interval": 60, - }, - "sway/workspaces": { + "custom/clock": { + "exec": "date +'%A %d/%m/%Y %H:%M'", + "interval": 60, + }, + "sway/workspaces": { "all-outputs": true }, "sway/mode": { @@ -204,6 +204,14 @@ "tooltip": true, "interval": 60, }, + "custom/vpn": { + "format": "{icon}", + "tooltip-format": "{icon}", + "exec": "$HOME/.config/waybar/modules/vpn_echo.sh", + "return-type": "json", + "interval": 5, + "format-icons": ["",""] + }, "network#openvpn": { "interface": "tun0", "format": "🔒", diff --git a/config/waybar/modules/vpn_echo.sh b/config/waybar/modules/vpn_echo.sh new file mode 100755 index 0000000..ddad96f --- /dev/null +++ b/config/waybar/modules/vpn_echo.sh @@ -0,0 +1,4 @@ +#!/bin/bash +ip addr | grep -q '10.10.10.2' \ + && echo '{"text":"Connected","class":"connected","percentage":100}' \ + || echo '{"text":"Disconnected","class":"disconnected","percentage":0}' diff --git a/config/waybar/style.css b/config/waybar/style.css index fe4f951..6f8df11 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -20,6 +20,7 @@ window#waybar.laptop { #mode, #disk, #network, +#custom-vpn, #cpu, #memory, #temperature, @@ -59,6 +60,7 @@ window#waybar.laptop { background: rgba(208, 135, 112, 0.7); } +#custom-vpn.disconnected, #network.disconnected { background: rgba(191, 97, 106, 0.7); }