diff --git a/wire_g b/wire_g index ad09dfc..55dc978 100755 --- a/wire_g +++ b/wire_g @@ -115,27 +115,26 @@ remove(){ nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}.wg_noactive.txt ACTIVE=$(cat ${WG_WDIR}.wg_noactive.txt) - nmcli connection delete $SELECTION &> ${WG_WDIR}.tmp.txt - if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${WG_WDIR}.tmp.txt) - then - yad --window-icon=${WG_PIC}wg-trash.png \ - --image-on-top --image=${WG_PIC}wg-info.png \ - --text=$"Your TUNNEL $SELECTION was successfully deleted." \ - --text-align=center --button=$"OK" --title "Wire-G Trash" \ - --center --buttons-layout=center --borders=8 - else - yad --window-icon=${WG_PIC}wg-trash.png \ - --image-on-top --image=${WG_PIC}wg-info.png \ - --text=$"Oh something went wrong.\nPlease delete TUNNEL in the network manager." \ - --text-align=center --button=$"OK" --title "Wire-G Trash" \ - --center --buttons-layout=center --borders=8 - fi - - if [ "$SELECTION" = "$ACTIVE" ] - then - pkill yad - fi } + nmcli connection delete $SELECTION &> ${WG_WDIR}.tmp.txt + if SUCCESS=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${WG_WDIR}.tmp.txt) + then + yad --window-icon=${WG_PIC}wg-trash.png \ + --image-on-top --image=${WG_PIC}wg-info.png \ + --text=$"Your Tunnel $SELECTION was successfully deleted." \ + --text-align=center --button=$"OK" --title "Wire-G Trash" \ + --center --buttons-layout=center --borders=8 + else + yad --window-icon=${WG_PIC}wg-trash.png \ + --image-on-top --image=${WG_PIC}wg-info.png \ + --text=$"Oh something went wrong.\nPlease delete Tunnel in the network manager." \ + --text-align=center --button=$"OK" --title "Wire-G Trash" \ + --center --buttons-layout=center --borders=8 + fi + if [ "$SELECTION" = "$ACTIVE" ] + then + pkill yad + fi } # function end ############################################################################################################ @@ -149,7 +148,7 @@ up_or_down(){ if [[ -z $ACTIVE ]] then yad --image-on-top --image=${WG_PIC}wg-info.png \ - --text=$"\There is no active TUNNEL that you could stop." \ + --text=$"\There is no active Tunnel that you could stop." \ --text-align=center --no-buttons --title "Wire-G" \ --borders=8 --undecorated \ --timeout 4 --timeout-indicator=bottom --skip-taskbar @@ -167,8 +166,6 @@ export -f up_or_down about(){ - WG_PIC="/home/$USER/.icons/" - VERSION=3.1.5 yad --title="Wire-G" --center \ --borders=8 --buttons-layout=center --text-align=center \ --button=$"OK" --undecorated \ @@ -182,7 +179,6 @@ about(){ Download Wire-G \n" } -export -f about # function end ############################################################################################################ @@ -210,7 +206,7 @@ SELECTION=$(yad --no-klick --list --center \ --button=$"Start:0" --button=$"Stop":"bash -c up_or_down" \ --button=$"Import":"bash -c import_wg" \ --button=$"Remove:4" --separator="" \ - --button=$"About":"bash -c about" \ + --button=$"About:5" \ --window-icon=${WG_PIC}wg-vpn.png \ --borders=8 --image-on-top --image=${WG_PIC}wg-active.png \ --column=$"Selection" $TUNNEL \ @@ -218,16 +214,21 @@ SELECTION=$(yad --no-klick --list --center \ ---------------------------------------------------------------------------------- If no Tunnels are listed, so they have to import their Tunnel beforehand.") -ret=$? +RET=$? [[ $? -eq 1 ]] && exit 0 -if [[ $ret -eq 4 ]] +if [[ $RET -eq 4 ]] then remove fi -if [[ $ret -eq 0 ]] +if [[ $RET -eq 5 ]] + then + remove +fi + +if [[ $RET -eq 0 ]] then if [[ -n $ACTIVE ]] then