This commit is contained in:
nomadics9 2024-10-24 15:16:20 +03:00
parent 262d5fae27
commit 8240f7d218
3 changed files with 30 additions and 1 deletions

View file

@ -1,4 +1,4 @@
#!/bin/env/sh
#!/usr/bin/env bash
down() {
brightnessctl set 5%-

12
scripts/wg-status.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Get the interface name (assumes the interface is the first line output by `wg show`)
#interface=$(sudo wg show | grep '^interface:' | awk '{print $2}')
interface="nmd"
# Check if there is a recent handshake (this indicates the connection is active)
handshake=$(ip a show "$interface" | grep 'link')
if [[ -n "$handshake" ]]; then
echo "🔒 $interface"
else
echo "🌀"
fi

17
scripts/wg-toggle.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Get the interface name (change this to your actual WireGuard interface name if needed)
interface="nmd"
handshake=$(ip a show "$interface" | grep 'link')
# Check if WireGuard is up
if [[ -n "$handshake" ]]; then
# If it's up, bring it down
pkexec wg-quick down "$interface"
dunstify -a "WireGuard" "Disconnected from $interface"
else
# Otherwise, bring it up
pkexec wg-quick up "$interface"
dunstify -a "WireGuard" "Connected to $interface"
fi