notify-send entfernt

This commit is contained in:
Désiré Werner Menrath 2023-11-15 12:38:16 +01:00
parent e3783c62d5
commit b18c9ff049
3 changed files with 21 additions and 16 deletions

View File

@ -20,28 +20,25 @@ if grep -i 'mint\|debian\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1
echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli
if ! which yad > /dev/null ; then sudo apt install yad -y > /dev/null 2>&1 ; echo yad wird installiert. Bitte warten... ; fi
if ! which notify-send > /dev/null ; then sudo apt install libnotify-bin -y > /dev/null 2>&1 ; echo libnotify wird installiert. Bitte warten... ; fi
elif grep -i 'arch\|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
then
echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli
if ! which yad > /dev/null ; then sudo pacman -S --noconfirm yad > /dev/null 2>&1 ; echo yad wird installiert. Bitte warten... ; fi
if ! which notify-send > /dev/null ; then sudo pacman -S --noconfirm libnotify > /dev/null 2>&1 ; echo libnotify wird installiert. Bitte warten... ; fi
elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
then
echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli
if ! which yad > /dev/null ; then sudo dnf install yad > /dev/null 2>&1 ; echo yad wird installiert. Bitte warten... ; fi
if ! which notify-send > /dev/null ; then sudo dnf install libnotify > /dev/null 2>&1 ; echo libnotify wird installiert. Bitte warten... ; fi
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then
clear
echo Achtung OpenSuse wird nicht offiziell unterstützt!
echo
echo yad und libnotify müssen sie selbst installieren, wenn sie fortfahren!
echo yad müssen sie selbst installieren, wenn sie fortfahren!
echo da diese Pakete offiziell nicht verfügbar sind.
echo
read -p "Geben Sie i für die installation ein und die Eingabetaste, Abbruch mit jeder anderen Taste ..." RESPONSE

View File

@ -33,8 +33,12 @@ export TEXTDOMAINDIR="/usr/share/locale"
# hier wird die Ausgabe von nmcli für die ausVALUEung in die .stop.txt gespeichert
nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt
if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt)
then
notify-send --icon=${WG_PIC}wg-stop.png $"$VALUE Connection disconnected"
then
yad --image-on-top --image=${WG_PIC}wg-info.png \
--undecorated --borders=8 --skip-taskbar \
--text-align=center --no-buttons \
--timeout 4 --timeout-indicator=bottom \
--text=$"<span color='#0fad0a'><b>"$VALUE" Connection disconnected</b></span>"
fi
done
pkill yad

24
wire_g
View File

@ -46,9 +46,13 @@ wg_notify(){
*) OPEN=open ;;
esac
notify-send --icon=${WG_PIC}wg-vpn.png $"$ACTIVE powered"
yad --image-on-top --image=${WG_PIC}wg-vpn-info.png \
--undecorated --borders=8 --skip-taskbar \
--text-align=center --no-buttons \
--timeout 4 --timeout-indicator=bottom \
--text=$"<span color='#0fad0a'><b>"$ACTIVE" powered</b></span>"
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
nmcli con mod $active connection.autoconnect no
nmcli con mod "$ACTIVE" connection.autoconnect no
yad --notification \
--image="${WG_PIC}wg-vpn.png" \
@ -96,7 +100,7 @@ import_wg(){
*) yad --image-on-top --image=${WG_PIC}wg-info.png --height=150 --width=240 \
--text-align=center --undecorated --skip-taskbar \
--borders=12 --button="OK" --buttons-layout=center \
--borders=12 --button="OK" --buttons-layout=center --center \
--text $"<b>Oh, something went wrong. No valid Wireguard file. </b> \n
<b>Here is an example:</b><span color='#0fad0a'><b> my_wireguard.conf</b></span>"
import_wg ;;
@ -117,17 +121,17 @@ remove(){
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 \
yad --window-icon=${WG_PIC}wg-trash.png --undecorated \
--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" \
--text-align=center --button=$"OK" \
--center --buttons-layout=center --borders=8
else
yad --window-icon=${WG_PIC}wg-trash.png \
yad --window-icon=${WG_PIC}wg-trash.png --undecorated \
--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
--text-align=center --button=$"OK" --height=60 --width=350 \
--buttons-layout=center --borders=8 --fixed
fi
if [ "$SELECTION" = "$ACTIVE" ]
@ -147,7 +151,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 \
--borders=8 --undecorated \
--timeout 4 --timeout-indicator=bottom --skip-taskbar
@ -210,7 +214,7 @@ SELECTION=$(yad --no-klick --list --center \
--borders=8 --image-on-top --image=${WG_PIC}wg-active.png \
--column=$"Selection" $TUNNEL \
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$ACTIVE</b></span>
<b>----------------------------------------------------------------------------------</b>
<b>------------------------------------------------------------------------------------------</b>
<b>If no Tunnels are listed,</b>
<b>so they have to import their Tunnel beforehand.</b>")
RET=$?