From d68842c1bd9001d660f889e193785193cb2dabd2 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 28 May 2025 15:05:53 -0500 Subject: add wireguard up/down functions --- dotfiles/system/.profile.d/fzf.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh index 2193614..f195440 100644 --- a/dotfiles/system/.profile.d/fzf.sh +++ b/dotfiles/system/.profile.d/fzf.sh @@ -76,9 +76,11 @@ bk() { fi } + + # close wireguard connection first if already running, then # run wireguard, selecting the configuration file. -wg() { +wgup() { # Check if wireguard is running output=$(sudo wg) if [[ -n "$output" ]]; then @@ -95,3 +97,13 @@ wg() { sudo wg fi } +wgdown() { + # Check if wireguard is running + output=$(sudo wg) + if [[ -n "$output" ]]; then + # Shutdown all wg interfaces if WireGuard is currently running. + for iface in $(sudo wg show interfaces); do + sudo wg-quick down "${iface}" + done + fi +} -- cgit v1.2.3