From a32cd0560a7bc687dbb7fac10e2823d3a0c77f9e Mon Sep 17 00:00:00 2001 From: punix Date: Mon, 27 Nov 2023 09:19:40 +0100 Subject: [PATCH] =?UTF-8?q?autoconnect=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wg_on_start | 14 +++++--------- wire_g | 7 +++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/wg_on_start b/wg_on_start index 236ef2f..1a4b838 100644 --- a/wg_on_start +++ b/wg_on_start @@ -35,15 +35,11 @@ ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ # # *) OPEN=open ;; # esac - yad --image-on-top --image=${WG_PIC}wg-vpn-info.png \ - --undecorated --borders=8 --skip-taskbar \ - --text-align=center --no-buttons --auto-close \ - --timeout 1 \ - --text=$"$ACTIVE powered" - - # autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind - IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) ) - nmcli con mod "$lines" connection.autoconnect no + yad --image-on-top --image=${WG_PIC}wg-vpn-info.png \ + --undecorated --borders=8 --skip-taskbar \ + --text-align=center --no-buttons --auto-close \ + --timeout 1 \ + --text=$"$ACTIVE powered" yad --notification \ --image="${WG_PIC}wg-vpn.png" \ diff --git a/wire_g b/wire_g index 9c2ba98..4ddad00 100755 --- a/wire_g +++ b/wire_g @@ -37,7 +37,7 @@ ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ ############################################################################################################ wg_notify(){ - sleep 2 + sleep 1 nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') case $LANG in @@ -51,9 +51,6 @@ wg_notify(){ --text-align=center --no-buttons --auto-close \ --timeout 1 \ --text=$"$ACTIVE powered" - # autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind - IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) ) - nmcli con mod "$lines" connection.autoconnect no yad --notification \ --image="${WG_PIC}wg-vpn.png" \ @@ -102,10 +99,12 @@ import_wg(){ then wg_stop nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt + nmcli con mod "$WG_CONF" connection.autoconnect no wg_notify else kill $lines nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt + nmcli con mod "$WG_CONF" connection.autoconnect no wg_notify fi nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt