diff --git a/wire_g b/wire_g index 050937a..dcf0efa 100755 --- a/wire_g +++ b/wire_g @@ -42,7 +42,6 @@ wg_notify(){ a_user=$(whoami) active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') wg_pic="/home/$a_user/.icons/" - pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') case $LANG in de_DE.UTF-8) open=öffnen ;; @@ -61,10 +60,6 @@ wg_notify(){ --menu="Wire-G $open!/sbin/wire_g |$active stop!/sbin/wg_stop" \ --command="menu" - while [[ -z $active ]] - do - kill $pid - done } export -f wg_notify @@ -151,11 +146,12 @@ remove(){ --text-align=center --button=$"OK" --title "Wire-G Trash" \ --center --buttons-layout=center --borders=8 fi - # if [ "$selection" = "$active" ] - # then - # pkill wire_g - # kill yad - # fi + if [ "$selection" = "$active" ] + then + pkill wire_g + kill yad + wire_g + fi fi } export -f remove @@ -235,7 +231,7 @@ if selection=$(yad --no-klick --list --center \ --text=$"Activ Tunnel: $active ---------------------------------------------------------------------------------- If no tunnels are listed, -so they have to import their tunnel beforehand.") +so they have to import their tunnel beforehand.") & then if [[ -n $active ]] then @@ -243,11 +239,14 @@ if selection=$(yad --no-klick --list --center \ nmcli connection up $selection &> ${wg_wdir}.tmp.txt connect pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') + kill $pid + wire_g else nmcli connection up $selection &> ${wg_wdir}.tmp.txt connect pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') - + kill $pid + wire_g fi fi