about checkbox save select

This commit is contained in:
Désiré Werner Menrath 2023-11-19 11:15:52 +01:00
parent 40477c2162
commit e24f1c770f
4 changed files with 154 additions and 9 deletions

View File

@ -19,18 +19,21 @@ if grep -i 'mint\|debian\|ubuntu\|pop|' /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
cp wg_on_start /home/"$USER"/.config/bin/
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
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
cp wg_on_start /home/"$USER"/.config/bin/
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
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
cp wg_on_start /home/"$USER"/.config/bin/
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
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1 elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
@ -46,6 +49,8 @@ elif grep -i 'suse' /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
cp wg_on_start /home/"$USER"/.config/bin/
else else
exit 1 exit 1
fi fi

87
wg_on_start Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
########################################################
########################################################
# Wire-G App for simple management a Wireguard TUNNEL ##
# Author: Désiré Werner Menrath ##
# Email: polunga40@unity-mail.de ##
# Translate German to English with LibreTranslate ##
# Translatefiles edit with Poedit ##
# Use without warranty! ##
########################################################
########################################################
Encoding=UTF-8
# i18n - Internationalization - Internationalisierung
export TEXTDOMAIN=wire-g
export TEXTDOMAINDIR="/usr/share/locale"
############################################################################################################
############################################################################################################
# wg_workdir Arbeitsverzeichnis wg
WG_WDIR="/home/$USER/.config/wg_nmcli/"
# Pfad wg Icons
WG_PIC="/home/$USER/.icons/"
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
case $LANG in
de_DE.UTF-8) OPEN=öffnen ;;
*) OPEN=open ;;
esac
yad --image-on-top --image=${WG_PIC}wg-vpn-info.png \
--undecorated --borders=8 --skip-taskbar \
--text-align=center --no-buttons --auto-close \
--timeout 1 \
--text=$"<span color='#0fad0a'><b>"$ACTIVE"</b></span> <span><b>powered</b></span>"
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) )
nmcli con mod "$lines" connection.autoconnect no
# if AUTOSTART=$(grep 'TRUE TRUE\|TRUE FALSE' ${WG_WDIR}about.txt)
# then
# nmcli con mod "$ACTIVE" connection.autoconnect yes
# if [ -d /etc/xdg/autostart ]
# then
# echo "Autostartordner in /etc/xdg/ gefunden"
# elif [ -d /usr/share/autostart ]
# then
# fi
yad --notification \
--image="${WG_PIC}wg-vpn.png" \
--icon-size=32 --no-middle \
--text=$"$ACTIVE activ" \
--menu="Wire-G $OPEN!/sbin/wire_g
|$ACTIVE stop!/sbin/wg_stop" \
--command="menu" &
# Schreib die pid von Notify in
pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
echo $pid > ${WG_WDIR}for-kill_pid.txt
IFS=$'\n' lines=( $(cat ${WG_WDIR}for-kill_pid.txt) )

4
wg_on_start.desktop Normal file
View File

@ -0,0 +1,4 @@
[Desktop Entry]
Type=Application
Name=wg_on_start
Exec=/home/"$USER"/.config/bin/wg_on_start

49
wire_g
View File

@ -184,7 +184,24 @@ up_or_down(){
# function button "about" # function button "about"
about(){ about(){
if AUTOSTART=$(grep 'TRUE TRUE' ${WG_WDIR}about.txt)
then
yad --form --fixed \
--borders=8 --buttons-layout=center --text-align=center \
--button="OK" --undecorated \
--field="Autoconnect on PC Start:CHK" TRUE \
--field="Autoupdate:CHK" TRUE \
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
<span color='#626ff1'><b>Use without warranty.</b></span> \n
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
if AUTOSTART=$(grep 'FALSE TRUE' ${WG_WDIR}about.txt)
then
yad --form --fixed \ yad --form --fixed \
--borders=8 --buttons-layout=center --text-align=center \ --borders=8 --buttons-layout=center --text-align=center \
--button="OK" --undecorated \ --button="OK" --undecorated \
@ -197,6 +214,38 @@ about(){
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n <span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
<span color='#626ff1'><b>Version: $VERSION </b></span> \n <span color='#626ff1'><b>Version: $VERSION </b></span> \n
<span color='#626ff1'><b>Use without warranty.</b></span> \n <span color='#626ff1'><b>Use without warranty.</b></span> \n
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
if AUTOSTART=$(grep 'FALSE FALSE' ${WG_WDIR}about.txt)
then
yad --form --fixed \
--borders=8 --buttons-layout=center --text-align=center \
--button="OK" --undecorated \
--field="Autoconnect on PC Start:CHK" FALSE \
--field="Autoupdate:CHK" FALSE \
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
<span color='#626ff1'><b>Use without warranty.</b></span> \n
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
if AUTOSTART=$(grep 'TRUE FALSE' ${WG_WDIR}about.txt)
then
yad --form --fixed \
--borders=8 --buttons-layout=center --text-align=center \
--button="OK" --undecorated \
--field="Autoconnect on PC Start:CHK" TRUE \
--field="Autoupdate:CHK" FALSE \
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
<span color='#626ff1'><b>Use without warranty.</b></span> \n
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt <a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
} }