neues remove Fenster

This commit is contained in:
Désiré Werner Menrath 2023-11-10 22:20:33 +01:00
parent 1d5d98930a
commit 2eb6b6adfc
2 changed files with 15 additions and 5 deletions

1
.tmp.txt Normal file
View File

@ -0,0 +1 @@
Fehler: weder eine gültige Verbindung noch ein Gerät angegeben.

17
wire_g
View File

@ -130,6 +130,15 @@ remove(){
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${wg_wdir}.wg_noactive.txt
active=$(cat ${wg_wdir}.wg_noactive.txt)
if selection=$(yad --no-click --list --center \
--window-icon=${wg_pic}wg-trash.png \
--height=200 --width=60 --undecorated \
--buttons-layout=center --separator="" \
--button=$"OK" --button=$"Cancel" \
--borders=8 \
--column=$"Delete" $tunnel)
then
nmcli connection delete $selection &> ${wg_wdir}.tmp.txt
if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
then
@ -149,7 +158,8 @@ remove(){
then
pkill wire_g
pkill yad
fi }
fi
fi }
export -f remove
# function end
@ -218,9 +228,9 @@ connect(){
if selection=$(yad --no-klick --list --center \
--height=300 --width=60 --title="Wire-G" \
--buttons-layout=center \
--button=$"OK" --button=$"Stop":"bash -c up_or_down" \
--button=$"Start:0" --button=$"Stop":"bash -c up_or_down" \
--button=$"Import":"bash -c import_wg" \
--form --field=$"Remove:0""bash -c remove" --separator="" \
--button=$"Remove":"bash -c remove" --separator="" \
--button=$"About":"bash -c about" \
--window-icon=${wg_pic}wg-vpn.png \
--borders=8 --image-on-top --image=${wg_pic}wg-active.png \
@ -229,7 +239,6 @@ if selection=$(yad --no-klick --list --center \
<b>----------------------------------------------------------------------------------</b>
<b>If no tunnels are listed,</b>
<b>so they have to import their tunnel beforehand.</b>")
export selection
then
if [[ -n $active ]]
then