diff --git a/wire_g b/wire_g index a0ddfb7..9067ef7 100755 --- a/wire_g +++ b/wire_g @@ -91,10 +91,10 @@ import_wg(){ nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt wg_notify else + pkill yad nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt wg_notify fi - kill -n $pid wire_g fi ;; @@ -146,7 +146,8 @@ remove(){ --text-align=center --button=$"OK" --title "Wire-G Trash" \ --center --buttons-layout=center --borders=8 fi - kill -n $pid + pkill yad + wg_notify wire_g if [ "$selection" = "$active" ] then @@ -174,7 +175,6 @@ up_or_down(){ --center --buttons-layout=center --borders=8 else wg_stop - kill -n $pid wire_g fi } @@ -189,7 +189,7 @@ about(){ a_user=$(whoami) wg_pic="/home/$a_user/.icons/" version=3.1.3 - selection=$(yad --title="Wire-G" --center \ + yad --title="Wire-G" --center \ --borders=8 --close-on-unfocus \ --buttons-layout=center --text-align=center \ --button=$"OK" --fixed \ @@ -199,7 +199,7 @@ about(){ At all tunnels, the auto start is disabled. \n Version: $version \n Use without warranty. \n -Download Wire-G \n") +Download Wire-G \n" } export -f about @@ -213,6 +213,7 @@ connect(){ if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt) then + pkill yad nmcli con mod $selection connection.autoconnect no wg_notify wire_g @@ -237,16 +238,18 @@ if selection=$(yad --no-klick --list --center \ ---------------------------------------------------------------------------------- If no tunnels are listed, so they have to import their tunnel beforehand.") -export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') + then if [[ -n $active ]] then wg_stop nmcli connection up $selection &> ${wg_wdir}.tmp.txt + export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') connect kill -n $pid else nmcli connection up $selection &> ${wg_wdir}.tmp.txt + export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') connect kill -n $pid fi