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... echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli 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 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 elif grep -i 'arch\|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
then then
echo Wire-G wird installiert... echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli 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 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 elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
then then
echo Wire-G wird installiert... echo Wire-G wird installiert...
mkdir -p /home/"$USER"/.icons ; cp icons/* /home/"$USER"/.icons/ ; mkdir -p /home/"$USER"/.config/wg_nmcli 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 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 elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then then
clear clear
echo Achtung OpenSuse wird nicht offiziell unterstützt! echo Achtung OpenSuse wird nicht offiziell unterstützt!
echo 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 da diese Pakete offiziell nicht verfügbar sind.
echo echo
read -p "Geben Sie i für die installation ein und die Eingabetaste, Abbruch mit jeder anderen Taste ..." RESPONSE 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 # hier wird die Ausgabe von nmcli für die ausVALUEung in die .stop.txt gespeichert
nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt
if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt) if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt)
then then
notify-send --icon=${WG_PIC}wg-stop.png $"$VALUE Connection disconnected" 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 fi
done done
pkill yad pkill yad

24
wire_g
View File

@ -46,9 +46,13 @@ wg_notify(){
*) OPEN=open ;; *) OPEN=open ;;
esac 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 # 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 \ yad --notification \
--image="${WG_PIC}wg-vpn.png" \ --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 \ *) yad --image-on-top --image=${WG_PIC}wg-info.png --height=150 --width=240 \
--text-align=center --undecorated --skip-taskbar \ --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 --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>" <b>Here is an example:</b><span color='#0fad0a'><b> my_wireguard.conf</b></span>"
import_wg ;; import_wg ;;
@ -117,17 +121,17 @@ remove(){
nmcli connection delete $SELECTION &> ${WG_WDIR}.tmp.txt nmcli connection delete $SELECTION &> ${WG_WDIR}.tmp.txt
if SUCCESS=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${WG_WDIR}.tmp.txt) if SUCCESS=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${WG_WDIR}.tmp.txt)
then 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 \ --image-on-top --image=${WG_PIC}wg-info.png \
--text=$"Your Tunnel $SELECTION was successfully deleted." \ --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 --center --buttons-layout=center --borders=8
else 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 \ --image-on-top --image=${WG_PIC}wg-info.png \
--text=$"Oh something went wrong.\nPlease delete Tunnel in the network manager." \ --text=$"Oh something went wrong.\nPlease delete Tunnel in the network manager." \
--text-align=center --button=$"OK" --title "Wire-G Trash" \ --text-align=center --button=$"OK" --height=60 --width=350 \
--center --buttons-layout=center --borders=8 --buttons-layout=center --borders=8 --fixed
fi fi
if [ "$SELECTION" = "$ACTIVE" ] if [ "$SELECTION" = "$ACTIVE" ]
@ -147,7 +151,7 @@ up_or_down(){
if [[ -z $ACTIVE ]] if [[ -z $ACTIVE ]]
then then
yad --image-on-top --image=${WG_PIC}wg-info.png \ 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 \ --text-align=center --no-buttons \
--borders=8 --undecorated \ --borders=8 --undecorated \
--timeout 4 --timeout-indicator=bottom --skip-taskbar --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 \ --borders=8 --image-on-top --image=${WG_PIC}wg-active.png \
--column=$"Selection" $TUNNEL \ --column=$"Selection" $TUNNEL \
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$ACTIVE</b></span> --text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$ACTIVE</b></span>
<b>----------------------------------------------------------------------------------</b> <b>------------------------------------------------------------------------------------------</b>
<b>If no Tunnels are listed,</b> <b>If no Tunnels are listed,</b>
<b>so they have to import their Tunnel beforehand.</b>") <b>so they have to import their Tunnel beforehand.</b>")
RET=$? RET=$?