diff --git a/wire_g b/wire_g index 5d04c39..c53c6a7 100755 --- a/wire_g +++ b/wire_g @@ -57,12 +57,11 @@ import_wg(){ a_user=$(whoami) wg_pic="/home/$a_user/.icons/" wg_wdir="/home/$a_user/.config/wg_nmcli/" - wgconf=$(yad --file --separator=" \n" \ + if wgconf=$(yad --file --separator=" \n" \ --button="OK" --button="Cancel" \ --width=1200 --height=800 \ --window-icon=${wg_pic}wg-import.png \ --title="Wireguard .conf Select file") - if [ "$?" = "0" ] then active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') if [[ -n $active ]] @@ -90,13 +89,12 @@ remove(){ nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${wg_wdir}.wg_noactive.txt active=$(cat ${wg_wdir}.wg_noactive.txt) - selection=$(yad --no-click --list --height=300 --width=60 \ + if selection=$(yad --no-click --list --height=300 --width=60 \ --title="Wire-G Trash" --center \ --fixed --buttons-layout=center \ --button="OK" --button="Cancel" \ --separator="" --window-icon=${wg_pic}wg-trash.png \ --borders=8 --column 'Delete' $tunnel) - if [ "$?" = "0" ] then nmcli connection delete $selection &> ${wg_wdir}.tmp.txt success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt) @@ -174,8 +172,7 @@ export -f more connect(){ - success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt) - if [ "$?" = "0" ] + if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt) then nmcli con mod $selection connection.autoconnect no wg_notify @@ -186,7 +183,7 @@ connect(){ ############################################################################################################ # --text "Aktiver Tunnel: $active # mit gewünschtes wort wird fett geschrieben. # Farbe für Variable $active festgelegt mit fetter Schrift. (bei --text zwischen " ") -selection=$(yad --no-click --list \ +if selection=$(yad --no-click --list \ --close-on-unfocus --center \ --height=300 --width=60 --title="Wire-G" \ --fixed --buttons-layout=center \ @@ -199,7 +196,6 @@ selection=$(yad --no-click --list \ If no tunnels are listed, so they have to import their tunnel beforehand." \ --column 'Selection' $tunnel) -if [ "$?" = "0" ] then if [[ -n $active ]]