bHELPER/bHELPER.sh

1144 lines
35 KiB
Bash

#!/usr/bin/env bash
SkriptVersion="2024-03-24 00:50"
gl_SkriptName=$(basename "${0}")
gl__SkriptPfadName=$(cd "$(dirname "${0}")"; pwd -P)/$(basename "${0}")
gl_SkriptOrdner=$(cd "$(dirname "${0}")"; pwd -P)/
gl__nmcli_dev_status="${0}.nmcli_dev_status.tmp" && nmcli dev status > ${gl__nmcli_dev_status}
gl__config_folder="${HOME}/.config/bHELPER/"
gl__config_file="${HOME}/.config/bHELPER/bHELPER.conf"
gl__osname=$(grep "NAME=" /etc/os-release | sed "s/NAME=//" | sed "s/\"//")
gl__osprettyname=$(grep "^PRETTY_NAME" /etc/os-release | grep -o "\".*\"" | sed "s/^\"//" | sed "s/\"$//")
gl__ipv4_eth=$(ip addr list | sed -n '/^[0-9]: e/,/^[0-9]: [a-z]/p' | grep -o "inet [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}")
gl__ipv4_wlan=$(ip addr list | grep -A2 ": wl[a-z0-9]\{3\}" | grep -o "inet [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}")
gl__wlan_ssid=$(grep " wifi " ${gl__nmcli_dev_status} | awk '{print $NF}')
gl__wlandev=$(grep " wifi " ${gl__nmcli_dev_status} | awk '{print $1}')
gl__wlanactive=$(grep " wifi " ${gl__nmcli_dev_status} | grep -o "verbunden \|nicht verbunden\|nicht verfügbar\|wird verbunden" | sed "s/^[ \t]*//;s/[ \t]*$//")
gl__bat_charge=$(inxi --battery | grep -o "charge: .*condition" | sed "s/^.*Wh//" | grep -o "[0-9]\{1,3\}\.[0-9]%\|[0-9]\{1,3\}%" | sed ':a;N;$!ba;s/\n/ /g')
rm "${gl__nmcli_dev_status}"
[[ -d ${HOME}/Desktop/ ]] && gl__desktop_vz="Desktop/"
[[ -d ${HOME}/Schreibtisch/ ]] && gl__desktop_vz="Schreibtisch/"
[[ -d "${gl__config_folder}" ]] || mkdir -p "${gl__config_folder}" ; touch "${gl__config_file}"
################################################################################
### Desktop Icon
################################################################################
if ! grep "^desktopiconautom=no" "${gl__config_file}" &> /dev/null ; then
cat <<_EOF_ > "${HOME}/${gl__desktop_vz}bHELPER.desktop"
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=bHELPER
Icon=${HOME}/.bHELPER/bHELPER.png
Exec=bash '${HOME}/.bHELPER/bHELPER.sh'
Type=Application
Terminal=true
_EOF_
chmod 755 "${HOME}/${gl__desktop_vz}bHELPER.desktop"
fi
################################################################################
### Optik
################################################################################
gl__format_red=$(echo -e "\033[1;31m")
gl__format_green=$(echo -e "\033[1;32m")
gl__format_cyanlight=$(echo -e "\033[1;96m")
gl__format_off=$(echo -e "\033[0m")
gl__datei_anfang=$(echo "${gl__format_red}-------- "${datei}" (ANFANG) -----------------------------------------------------------------${gl__format_off}")
gl__datei_ende=$(echo "${gl__format_red}-------- "${datei}" (ENDE) -------------------------------------------------------------------${gl__format_off}")
gl__ausgabe_anfang=$(echo "${gl__format_red}---- Terminalausgabe (Anfang) --------------------------------------------------------------------------${gl__format_off}")
gl__ausgabe_ende=$(echo "${gl__format_red}---- Terminalausgabe (Ende) ----------------------------------------------------------------------------${gl__format_off}")
gl__bittewaehlen=$(echo " ${gl__format_red}Bitte wählen und ENTER drücken!${gl__format_off}")
function task_title {
echo -e "${gl__format_cyanlight}${1}${gl__format_off}"
}
function task_title_syntax {
echo -e " ${gl__format_red}Ausgeführte Syntax:${gl__format_off} ${1}${gl__format_off}"
}
function terminal_output_begin {
echo ""
echo "${gl__format_red}---- Terminalausgabe (Anfang) --------------------------------------------------------------------------${gl__format_off}"
}
function terminal_output_end {
echo "${gl__format_red}---- Terminalausgabe (Ende) ----------------------------------------------------------------------------${gl__format_off}"
echo "" ; echo ""
}
################################################################################
### Favoriten
################################################################################
[[ -f /usr/bin/nautilus ]] && gl__favdateimanager="/usr/bin/nautilus"
[[ -f /usr/bin/thunar ]] && gl__favdateimanager="/usr/bin/thunar"
[[ -f /usr/bin/caja ]] && gl__favdateimanager="/usr/bin/caja"
[[ -f /usr/bin/dolphin ]] && gl__favdateimanager="/usr/bin/dolphin --split"
[[ -f /usr/bin/vim ]] && gl__fav_editor="/usr/bin/vim"
[[ -f /usr/bin/nano ]] && gl__fav_editor="/usr/bin/nano"
[[ -f /usr/bin/kwrite ]] && gl__fav_editor="/usr/bin/kwrite"
[[ -f /usr/bin/gedit ]] && gl__fav_editor="/usr/bin/gedit"
[[ -f /usr/bin/kate ]] && gl__fav_editor="/usr/bin/kate"
[[ -f /usr/bin/geany ]] && gl__fav_editor="/usr/bin/geany"
[[ -f /usr/bin/evince ]] && gl__favpdfviewer="/usr/bin/evince"
[[ -f /usr/bin/okular ]] && gl__favpdfviewer="/usr/bin/okular"
[[ -f /usr/bin/texmaker ]] && gl_favtexeditor="/usr/bin/texmaker"
[[ -f /usr/bin/gnome-latex ]] && gl_favtexeditor="/usr/bin/gnome-latex"
[[ -f /usr/bin/qupzilla ]] && gl__favbrowser="/usr/bin/qupzilla"
[[ -f /usr/bin/konqueror ]] && gl__favbrowser="/usr/bin/konqueror"
[[ -f /usr/bin/firefox ]] && gl__favbrowser="/usr/bin/firefox"
[[ -f /usr/bin/clementine ]] && gl__fav_audioplayer="/usr/bin/clementine"
[[ -f /usr/bin/vlc ]] && gl__fav_videoplayer="/usr/bin/vlc"
################################################################################
### STARTSEITE
################################################################################
### LÜFTERDREHZAHL
fanspeed=$(inxi --sensors | grep -o "fan-1.*$")
### CPU TEMPERATUR
if [ -f /usr/bin/sensors ]; then
sensorsvar="${0}.sensors.tmp"
sensors > "${sensorsvar}"
core0temp=$(grep "Core 0" "${sensorsvar}" | awk '{print $3}')
core1temp=$(grep "Core 1" "${sensorsvar}" | awk '{print $3}')
core2temp=$(grep "Core 2" "${sensorsvar}" | awk '{print $3}')
core3temp=$(grep "Core 3" "${sensorsvar}" | awk '{print $3}')
rm "${sensorsvar}"
fi
### LAUTSTÄRKE
gl__lautstaerke=$(amixer | grep -o "\[off\]\|\[on\]" | head -1 | sed "s/\[//g" | sed "s/\]//g")
gl__lautstaerkeprozent=$(amixer | grep "%" | head -1 | grep -o "\[[0-9]\{1,3\}%\]" | uniq | sed "s/\[//g" | sed "s/\]//g")
if [ ${gl__lautstaerke} = "off" ] ; then
gl__lautstaerke="Ton: ${gl__format_red}AUS${gl__format_off} Lautstärke (Master): ${gl__format_red}${gl__lautstaerkeprozent}${gl__format_off}"
gl__ton_anaus="AUS"
else
gl__lautstaerke="Ton: ${gl__format_red}EIN${gl__format_off} Lautstärke (Master): ${gl__format_red}${gl__lautstaerkeprozent}${gl__format_off}"
gl__ton_anaus="EIN"
fi
gl__lautstaerkeprozent=$(amixer | grep "%" | head -1 | grep -o "\[[0-9]\{1,3\}%\]" | sed "s/\[//g" | sed "s/\]//g")
### MIKROFONE
function mic_status {
gl__mic_mutestatus=$(amixer | grep -A 5 "Simple mixer control .Capture." | grep -o "\[on\]\|\[off\]" | head -n 1 | sed "s/\[//g" | sed "s/\]//g")
}
mic_status
# Device Namen
pacmd_mic_list=$(pacmd list-sources | grep "alsa_input" | sed -e "s/name: <//g" -e "s/>//g" | sed "s/^[ \t]*//;s/[ \t]*$//")
function bannerstart {
echo -e ""
echo -e " ${gl__format_red}88 88 88 88888888 88 88888b. 88888888 888888b. ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 Y8b 88 88 Y8b ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 88 88 88 88 ${gl__format_off}"
echo -e " ${gl__format_red}88888b. 88888888 888888 88 88 d8P 888888 88 d8P ${gl__format_off}"
echo -e " ${gl__format_red}88 \"8b 88 88 88 88 88888P\" 88 88888P\" ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 88 88 88 T8b ${gl__format_off}"
echo -e " ${gl__format_red}88 d8P 88 88 88 88 88 88 88 T8b ${gl__format_off}"
echo -e " ${gl__format_red}8888P\" 88 88 88888888 8888888 88 88888888 88 T8b ${gl__format_off}"
echo -e ""
echo -e " ${gl__format_red}Version:${gl__format_off} ${SkriptVersion} ${gl__format_red}Ton:${gl__format_off} ${gl__ton_anaus} ${gl__format_red}Volume:${gl__format_off} ${gl__lautstaerkeprozent} ${gl__format_red}Mikros:${gl__format_off} ${gl__mic_mutestatus}"
echo -e " ${gl__format_red}EN:${gl__format_off} ${gl__ipv4_eth} ${gl__format_red}OS:${gl__format_off} ${gl__osprettyname} ${gl__format_red}Hostname:${gl__format_off} ${HOSTNAME}"
echo -e " ${gl__format_red}WLAN:${gl__format_off} ${gl__wlanactive} ${gl__format_red}WLAN IP:${gl__format_off} ${gl__ipv4_wlan} ${gl__format_red}WLAN SSID:${gl__format_off} ${gl__wlan_ssid}"
echo -e " ${gl__format_red}Akku:${gl__format_off} ${gl__bat_charge} ${gl__format_red}Lüfterdrehzahl:${gl__format_off} ${fanspeed} ${gl__format_red}CPU:${gl__format_off} ${core0temp} ${core1temp} ${core2temp} ${core3temp} ${core4temp} ${core5temp} ${core6temp} ${core7temp}"
}
function banner {
clear
echo -e ""
echo -e " ${gl__format_red}88 88 88 88888888 88 88888b. 88888888 888888b. ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 Y8b 88 88 Y8b ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 88 88 88 88 ${gl__format_off}"
echo -e " ${gl__format_red}88888b. 88888888 888888 88 88 d8P 888888 88 d8P ${gl__format_off}"
echo -e " ${gl__format_red}88 \"8b 88 88 88 88 88888P\" 88 88888P\" ${gl__format_off}"
echo -e " ${gl__format_red}88 88 88 88 88 88 88 88 88 T8b ${gl__format_off}"
echo -e " ${gl__format_red}88 d8P 88 88 88 88 88 88 88 T8b ${gl__format_off}"
echo -e " ${gl__format_red}8888P\" 88 88 88888888 8888888 88 88888888 88 T8b ${gl__format_off}"
echo -e ""
echo -e "${gl__format_red} ${bannertitel} ${gl__format_off}"
echo ""; echo ""
}
function pause {
echo -e ""
echo -e ""
read -p "${gl__format_red}Drücke ENTER um weiterzumachen${gl__format_off}"
}
function ende {
read -p "${gl__format_red}Drücke ENTER um weiterzumachen${gl__format_off}"
}
function endedasi {
echo -e ""
echo -e ""
read -p "${gl__format_red}Das Verzeichnis existiert nicht. Tschüss!${gl__format_off}"
exit
}
clear
bannerstart
echo ""
echo ""
echo " ${gl__format_red}| H |${gl__format_off} Hardware ${gl__format_red}| S |${gl__format_off} Software"
echo " ${gl__format_red}| F |${gl__format_off} Dateien & Verzeichn. ${gl__format_red}| I |${gl__format_off} Netzwerk"
echo " ${gl__format_red}| R |${gl__format_off} Herunterf./Neustart "
if [[ ${XDG_CURRENT_DESKTOP} =~ .*KDE.* ]]
then
echo " ${gl__format_red}| K |${gl__format_off} KDE Plasma"
fi
echo ""
echo ""
echo " ${gl__format_red}| E |${gl__format_off} Einstellungen ${gl__format_red}| U |${gl__format_off} bHELPER aktualisieren"
echo ""
echo " ${gl__format_red}| V |${gl__format_off} leiser ${gl__format_red}| B |${gl__format_off} TON ein/aus ${gl__format_red}| N |${gl__format_off} lauter"
echo " ${gl__format_red}| M |${gl__format_off} Mikro(s) ein/aus ${gl__format_red}| X |${gl__format_off} Monitor sperren ${gl__format_red}| W |${gl__format_off} WLAN ein/aus"
echo ""
echo "${gl__bittewaehlen}"
read hauptmenue
case ${hauptmenue} in
################################################################################
### Bildschirm sperren
################################################################################
x|X)
if [[ ${XDG_CURRENT_DESKTOP} =~ .*KDE.* ]]
then
xdg-screensaver lock
fi
if [[ ${WINDOWMANAGER} =~ .*xfce.* ]]
then
xdg-scrrensaver lock
fi
if [[ ${XDG_CURRENT_DESKTOP} =~ .*Cinnamon.* ]]
then
cinnamon-screensaver-command --lock
fi
if [[ ${XDG_CURRENT_DESKTOP} =~ .*MATE.* ]]
then
mate-screensaver-command --lock
fi
;;
################################################################################
### Hardware
################################################################################
h|H)
bannertitel="Hauptmenü => Hardware"
banner
echo " ${gl__format_red}| 0 |${gl__format_off} Hardwareinformationen des Rechners (dmidecode)"
echo " ${gl__format_red}| 1 |${gl__format_off} Hardwareinformationen des Rechners (inxi)"
echo " ${gl__format_red}| B |${gl__format_off} Bluetooth"
echo " ${gl__format_red}| A |${gl__format_off} Laptopakkus (upower, inxi)"
echo " ${gl__format_red}| XK |${gl__format_off} xrandr - Bildschirmkonfiguration anzeigen lassen"
echo ""
echo "${gl__bittewaehlen}"
read hardware
case ${hardware} in
0)
bannertitel="Hauptmenü => Hardware => Hardwareinformationen eures Rechners (dmidecode)"
banner
sudo /usr/sbin/dmidecode -s system-manufacturer
bannertitel="Hauptmenü => Hardware => Hardwareinformationen eures Rechners (dmidecode)"
banner
echo " ${gl__format_red}Hersteller des Systems:${gl__format_off} $(sudo /usr/sbin/dmidecode -s system-manufacturer)"
echo " ${gl__format_red}Produktname des Systems:${gl__format_off} $(sudo /usr/sbin/dmidecode -s system-product-name)"
echo " ${gl__format_red}Modell Nr. des Systems:${gl__format_off} $(sudo /usr/sbin/dmidecode -s system-version)"
echo " ${gl__format_red}Verwendete BIOS-Version:${gl__format_off} $(sudo /usr/sbin/dmidecode -s bios-version)"
echo " ${gl__format_red}Hersteller des Mainboards:${gl__format_off} $(sudo /usr/sbin/dmidecode -s baseboard-manufacturer)"
echo " ${gl__format_red}Produktname des Mainboards:${gl__format_off} $(sudo /usr/sbin/dmidecode -s baseboard-product-name)"
echo " ${gl__format_red}Versionsnummer des Mainboards:${gl__format_off} $(sudo /usr/sbin/dmidecode -s baseboard-version)"
ende
;;
1)
bannertitel="Hauptmenü => Hardware => Hardwareinformationen des Rechners (inxi)"
banner
task_title "Hardwareinformationen des Rechners (inxi)"
task_title_syntax "inxi -Fxz"
terminal_output_begin
inxi -Fxz
terminal_output_end
ende
;;
b|B)
[[ -f /usr/sbin/rfkill ]] && rfkill_bin="/usr/sbin/rfkill"
[[ -f /usr/bin/rfkill ]] && rfkill_bin="/usr/bin/rfkill"
bannertitel="Hauptmenü => Hardware => Bluetooth"
banner
task_title "systemctl list-unit-files | grep -i "STATE\|blue""
task_title_syntax "systemctl list-unit-files | grep -i "STATE\|blue""
terminal_output_begin
systemctl list-unit-files | grep -i "STATE\|blue"
terminal_output_end
task_title "systemctl status bluetooth.service"
task_title_syntax "systemctl status bluetooth.service"
terminal_output_begin
systemctl status bluetooth.service
terminal_output_end
task_title "journalctl -o short-iso --no-pager -u bluetooth.service"
task_title_syntax "journalctl -o short-iso --no-pager -u bluetooth.service"
terminal_output_begin
journalctl -o short-iso --no-pager -u bluetooth.service
terminal_output_end
"bluetask_title tooth --help"
task_title_syntax "bluetooth --help"
terminal_output_begin
bluetooth --help
terminal_output_end
task_title "rfkill list bluetooth"
task_title_syntax "rfkill list bluetooth"
terminal_output_begin
${rfkill_bin} list bluetooth
terminal_output_end
task_title "inxi --bluetooth"
task_title_syntax "inxi --bluetooth"
terminal_output_begin
inxi --bluetooth
terminal_output_end
ende
;;
a|A)
bannertitel="Hauptmenü => Hardware => Akkuinformationen eures Laptops (upower, inxi)"
banner
task_title_syntax "upower -i /org/freedesktop/UPower/devices/battery_BAT0"
echo "${gl__ausgabe_anfang}"
upower -i /org/freedesktop/UPower/devices/battery_BAT0
echo "${gl__ausgabe_ende}"
echo ""
echo ""
task_title_syntax "inxi --battery"
echo "${gl__ausgabe_anfang}"
inxi --battery
echo "${gl__ausgabe_ende}"
ende
;;
xk|XK)
bannertitel="Hauptmenü => Hardware => Bildschirmkonfigurieren (xrandr)"
banner
task_title "Alle aktiven Monitore"
task_title_syntax "xrandr --listactivemonitors"
terminal_output_begin
xrandr --listactivemonitors
terminal_output_end
task_title "Alle vorhandene Monitoranschlüsse"
task_title_syntax "xrandr --listproviders"
terminal_output_begin
xrandr --listproviders
terminal_output_end
task_title "Komplette Ausgabe"
task_title_syntax "xrandr"
terminal_output_begin
xrandr
terminal_output_end
ende
;;
esac
;;
################################################################################
### Software
################################################################################
s|S)
bannertitel="Hauptmenü => Software"
banner
echo " ${gl__format_red}${gl__osprettyname}:${gl__format_off}"
if grep -q "Tumbleweed\|Ubuntu\|Manjaro\|Arch Linux\|Mint" /etc/os-release ; then
echo " ${gl__format_red}| U |${gl__format_off} Aktualisieren"
fi
echo ""
echo " ${gl__format_red}Paketverwaltungen:${gl__format_off}"
[[ -f /usr/bin/flatpak ]] && echo " ${gl__format_red}| F |${gl__format_off} Flatpak"
echo ""
echo " ${gl__format_red}Programme:${gl__format_off}"
echo " ${gl__format_red}| P |${gl__format_off} Informationen ausgeben lassen, ..."
echo ""
echo "${gl__bittewaehlen}"
read software
case ${software} in
u|U)
bannertitel="Hauptmenü => Software => Paketverwaltung => Linux Distribution aktualisieren"
banner
if test -f "/usr/bin/zypper"; then
task_title "Daten der Reporitories aktualisieren"
task_title_syntax "sudo zypper refresh"
terminal_output_begin
sudo zypper refresh
terminal_output_end
task_title "Anstehende Aktualisierungen anzeigen"
task_title_syntax "zypper list-updates"
terminal_output_begin
zypper list-updates
terminal_output_end
task_title "Aktualisierungen installieren"
task_title_syntax "sudo zypper dup"
terminal_output_begin
sudo zypper dup
terminal_output_end
fi
if [[ -f "/usr/bin/apt" || -f "/usr/local/bin/apt" ]]; then
task_title "Daten der Reporitories aktualisieren"
task_title_syntax "sudo apt update"
terminal_output_begin
sudo apt update
terminal_output_end
task_title "Anstehende Aktualisierungen anzeigen"
task_title_syntax "apt list --upgradable -a"
terminal_output_begin
apt list --upgradable -a
terminal_output_end
task_title "Aktualisierungen installieren"
task_title_syntax "sudo apt upgrade"
terminal_output_begin
sudo apt upgrade
terminal_output_end
fi
if test -f "/usr/bin/pacman"; then
task_title "Daten der Reporitories aktualisieren"
task_title_syntax "sudo pacman -Sy"
terminal_output_begin
sudo pacman -Sy
terminal_output_end
task_title "Anstehende Aktualisierungen anzeigen"
task_title_syntax "sudo pacman -Qu"
terminal_output_begin
sudo pacman -Qu
terminal_output_end
task_title "Aktualisierungen installieren"
task_title_syntax "sudo pacman -Su"
terminal_output_begin
sudo pacman -Su
terminal_output_end
fi
ende
;;
f|F)
bannertitel="Hauptmenü => Software => Flatpak"
banner
echo " ${gl__format_red}| U |${gl__format_off} Installierte Pakete aktualisieren"
echo " ${gl__format_red}| L |${gl__format_off} Installierte Pakete auflisten"
echo " ${gl__format_red}| S |${gl__format_off} Programme suchen"
echo " ${gl__format_red}| I |${gl__format_off} Programme installieren"
echo " ${gl__format_red}| R |${gl__format_off} Programme deinstallieren"
echo " ${gl__format_red}| G |${gl__format_off} Ungenutzte Pakete deinstallieren"
echo ""
echo "${gl__bittewaehlen}"
read flatpak
case ${flatpak} in
u|U)
bannertitel="Hauptmenü => Software => Flatpak => Installierte Pakete aktualisieren"
banner
task_title "Installierte Pakete aktualisieren"
task_title_syntax "sudo flatpak update"
terminal_output_begin
sudo /usr/bin/flatpak update
terminal_output_end
ende
;;
l|L)
bannertitel="Hauptmenü => Software => Flatpak => Installierte Pakete auflisten"
banner
task_title "Detaillierte Liste aller installierten Pakete"
task_title_syntax "flatpak list --show-details"
echo "${gl__ausgabe_anfang}"
/usr/bin/flatpak list --show-details
echo "${gl__ausgabe_ende}"
echo ""
echo ""
task_title "Liste aller installierten Pakete"
task_title_syntax "flatpak list"
echo "${gl__ausgabe_anfang}"
/usr/bin/flatpak list
echo "${gl__ausgabe_ende}"
echo ""
echo ""
task_title "Detaillierte Liste aller installierten Programme"
task_title_syntax "flatpak list --app --show-details"
echo "${gl__ausgabe_anfang}"
/usr/bin/flatpak list --app --show-details
echo "${gl__ausgabe_ende}"
echo ""
echo ""
task_title "Liste aller installierten Programme"
task_title_syntax "flatpak list --app"
echo "${gl__ausgabe_anfang}"
/usr/bin/flatpak list --app
echo "${gl__ausgabe_ende}"
ende
;;
g|G)
bannertitel="Hauptmenü => Software => Flatpak => Ungenutzte Pakete deinstallieren"
banner
task_title "Ungenutzte Pakete deinstallieren"
task_title_syntax "sudo flatpak uninstall --unused"
terminal_output_begin
sudo flatpak uninstall --unused
terminal_output_end
ende
;;
s|S)
bannertitel="Hauptmenü => Software => Flatpak => Programme suchen"
banner
read -p "${gl__format_red}Suchtext eigeben: ${gl__format_off}" search
banner
task_title "Programme suchen"
task_title_syntax "flatpak search ${search}"
terminal_output_begin
flatpak search ${search}
terminal_output_end
ende
;;
i|I)
bannertitel="Hauptmenü => Software => Flatpak => Programme installieren"
banner
read -p "${gl__format_red}Suchtext eigeben: ${gl__format_off}" search
banner
task_title "Programm installieren"
task_title_syntax "flatpak search ${search}"
terminal_output_begin
flatpak search ${search}
terminal_output_end
read -p "${gl__format_red}Application ID eigeben: ${gl__format_off}" applicationid
banner
task_title "Programme installieren"
task_title_syntax "sudo flatpak install ${applicationid}"
terminal_output_begin
sudo flatpak install ${applicationid}
terminal_output_end
ende
;;
r|R)
bannertitel="Hauptmenü => Software => Flatpak => Programme deinstallieren"
banner
task_title "Detaillierte Liste aller installierten Programme"
task_title_syntax "flatpak list --app --show-details"
terminal_output_begin
flatpak list --app --show-details
terminal_output_end
read -p "${gl__format_red}Application ID eigeben: ${gl__format_off}" applicationid
banner
task_title "Programme deinstallieren"
task_title_syntax "sudo flatpak uninstall ${applicationid}"
terminal_output_begin
sudo flatpak uninstall ${applicationid}
terminal_output_end
ende
;;
g|G)
bannertitel="Hauptmenü => Software => Flatpak => Ungenutzter Pakete deinstallieren"
banner
task_title "Ungenutzter Pakete deinstallieren"
task_title_syntax "sudo flatpak uninstall --unused"
terminal_output_begin
sudo /usr/bin/flatpak uninstall --unused
terminal_output_end
ende
;;
esac
;;
p|P)
bannertitel="Hauptmenü => Software => Programme"
banner
echo " ${gl__format_cyanlight}${gl__format_off} Mozilla Thunderbird ${gl__format_red}| T0 |${gl__format_off} Informationen"
echo "" ; echo ""
echo "${gl__bittewaehlen}"
read programme
case ${programme} in
t0|T0)
bannertitel="Hauptmenü => Software => Programme => Mozilla Thunderbird"
banner
task_title_syntax "thunderbird --version"
echo "${gl__ausgabe_anfang}"
[[ -f /usr/bin/thunderbird ]] && thunderbird --version
echo "${gl__ausgabe_ende}"
if [ -f "/usr/bin/zypper" ]; then
echo ""
task_title_syntax "zypper info MozillaThunderbird"
echo "${gl__ausgabe_anfang}"
[[ -f /usr/bin/zypper ]] && zypper info MozillaThunderbird
echo "${gl__ausgabe_ende}"
fi
if [ -f "/usr/bin/pacman" ]; then
echo ""
task_title_syntax "pacman -Qii thunderbird"
echo "${gl__ausgabe_anfang}"
[[ -f /usr/bin/pacman ]] && pacman -Qii thunderbird
echo "${gl__ausgabe_ende}"
fi
ende
;;
esac
;;
esac
;;
################################################################################
### Netzwerk
################################################################################
i|I)
bannertitel="Hauptmenü => Netzwerk"
banner
echo " ${gl__format_red}| A |${gl__format_off} Allgemeine Informationen"
echo " ${gl__format_red}| W |${gl__format_off} WLAN Informationen"
echo ""
echo "${gl__bittewaehlen}"
read netzwerk
case ${netzwerk} in
a|A)
bannertitel="Hauptmenü => Netzwerk => WLAN Informationen"
banner
task_title_syntax "ip address show"
echo "${gl__ausgabe_anfang}"
ip address show
echo "${gl__ausgabe_ende}"
echo ""
task_title_syntax "ip route list"
echo "${gl__ausgabe_anfang}"
ip route list
echo "${gl__ausgabe_ende}"
ende
;;
w|W)
[[ -f /usr/sbin/rfkill ]] && rfkill_bin="/usr/sbin/rfkill"
[[ -f /usr/bin/rfkill ]] && rfkill_bin="/usr/bin/rfkill"
bannertitel="Hauptmenü => Netzwerk => WLAN Informationen"
banner
task_title_syntax "rfkill list wifi"
echo "${gl__ausgabe_anfang}"
${rfkill_bin} list wifi
echo "${gl__ausgabe_ende}"
echo ""
task_title_syntax "inxi --network"
echo "${gl__ausgabe_anfang}"
inxi --network
echo "${gl__ausgabe_ende}"
ende
;;
esac
;;
################################################################################
### Dateien & Verzeichnisse
################################################################################
f|F)
bannertitel="Hauptmenü => Dateien & Verzeichnisse"
banner
echo " ${gl__format_red}| F |${gl__format_off} Nach Dateien und Verzeichnissen suchen"
echo " ${gl__format_red}| G |${gl__format_off} Die zehn größten Dateien in deinem ${HOME}"
echo " ${gl__format_red}| D |${gl__format_off} Duplikate von Dateien in deinem ${HOME} Verzeichnis finden"
echo ""
echo "${gl__bittewaehlen}"
read software
case ${software} in
g|G)
bannertitel="Hauptmenü => Dateien & Verzeichnisse => Die 10 größten Dateien"
banner
find ${HOME} -type f -print0 | xargs -0 du -h | sort -hr | head -10
ende
;;
f|F)
bannertitel="Hauptmenü => Dateien & Verzeichnisse => Nach Dateien und Verzeichnissen suchen"
banner
read -p "${gl__format_red}Zeichenfolge: ${gl__format_off}" zeichenfolge
echo -e ""
echo "${gl__format_red}---- Verzeichnisse die${gl__format_off} "${zeichenfolge}" ${gl__format_red}enthalten -------${gl__format_off}"
find "${HOME}" -iname "*${zeichenfolge}*" -type d
echo -e "${gl__format_red}----------------------------------------------------------${gl__format_off}"
echo -e ""
echo "${gl__format_red}---- Dateien die${gl__format_off} "${zeichenfolge}" ${gl__format_red}enthalten -------${gl__format_off}"
find "${HOME}" -iname "*${zeichenfolge}*" -type f -exec ls -alt --color=auto --time-style=long-iso {} + | sort -k 8
echo -e "${gl__format_red}----------------------------------------------------------${gl__format_off}"
ende
;;
d|D)
bannertitel="Hauptmenü => Dateien & Verzeichnisse => Duplikate von Dateien in deinem ${HOME} Verzeichnis finden"
banner
task_title "Duplikate von Dateien in deinem ${HOME} Verzeichnis finden"
task_title_syntax "find ${HOME} ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD"
terminal_output_begin
find ${HOME} ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD
terminal_output_end
ende
;;
esac
;;
########################################################################
### KDE
########################################################################
k|K)
[[ -f /usr/bin/kcmshell5 ]] && kcmshell_bin="/usr/bin/kcmshell5"
[[ -f /usr/bin/kcmshell6 ]] && kcmshell_bin="/usr/bin/kcmshell6"
bannertitel="Hauptmenü => KDE"
banner
echo " ${gl__format_red}Installierte Plasma Version: ${gl__format_off}`plasmashell --version | sed "s/plasmashell //"`"
echo ""
echo " ${gl__format_red}| EN |${gl__format_off} Energieprofile"
echo " ${gl__format_red}| AE |${gl__format_off} Anzeigeeinstellung"
echo " ${gl__format_red}| SL |${gl__format_off} Bildschirmsperre"
echo " ${gl__format_red}| SI |${gl__format_off} Sitzung"
echo " ${gl__format_red}| KW |${gl__format_off} KWin Regeln"
echo " ${gl__format_red}| EK |${gl__format_off} Eigene Kurzbefehle"
echo " ${gl__format_red}| MA |${gl__format_off} Maus"
echo ""
echo "${gl__bittewaehlen}"
read kde
case ${kde} in
en|EN) nohup ${kcmshell_bin} powerdevilprofilesconfig & ;;
ae|AE) nohup ${kcmshell_bin} kscreen & ;;
sl|SL) nohup ${kcmshell_bin} screenlocker & ;;
si|SI) nohup ${kcmshell_bin} kcm_smserver & ;;
kw|KW) nohup ${kcmshell_bin} kwinrules & ;;
ek|EK) nohup ${kcmshell_bin} khotkeys & ;;
ma|MA) nohup ${kcmshell_bin} kcm_mouse & ;;
esac
;;
################################################################################
### WLAN ein-/ausschalten
################################################################################
w|W)
bannertitel="Hauptmenü => WLAN ein-/ausschalten"
banner
if echo "${gl__wlanactive}" | grep "nicht verfügbar" &> /dev/null ; then
bannertitel="Hauptmenü => WLAN ein-/ausschalten => WLAN wird eingeschaltet"
banner
echo -e "WLAN ist ausgeschaltet und wird jetzt eingeschaltet. Das kann ein paar Sekunden dauern: \n"
nmcli radio wifi on
sleep 5
nmcli device status | grep "DEVICE\|wifi"
else
bannertitel="Hauptmenü => WLAN ein-/ausschalten => WLAN wird ausgeschaltet"
banner
echo -e "WLAN ist eingeschaltet und wird jetzt ausgeschaltet. Das kann ein paar Sekunden dauern: \n"
nmcli radio wifi off
sleep 5
nmcli device status | grep "DEVICE\|wifi"
fi
ende
;;
########################################################################
### TON an/aus/leiser/lauter
########################################################################
b|B)
gl__lautstaerke=$(amixer | grep -o "\[off\]\|\[on\]" | head -1 | sed "s/\[//g" | sed "s/\]//g")
if [ ${gl__lautstaerke} = "off" ] ; then
amixer sset Master unmute
else
amixer sset Master mute
fi
export gl__lautstaerke
;;
n|N)
amixer set Master 10%+
;;
v|V)
amixer set Master 10%-
;;
################################################################################
### Mikrofone ein-/ausschalten
################################################################################
m|M)
amixer set Capture toggle
;;
################################################################################
### Herunterfahren/Neustarten
################################################################################
r|R)
[[ -f /usr/sbin/shutdown ]] && shutdown_bin="/usr/sbin/shutdown"
[[ -f /usr/bin/shutdown ]] && shutdown_bin="/usr/bin/shutdown"
bannertitel="Hauptmenü => Herunterfahren/Neustarten"
banner
echo " ${gl__format_red}HERUNTERFAHREN${gl__format_off}"
echo " ${gl__format_red}==============${gl__format_off}"
echo " ${gl__format_red}| H1 |${gl__format_off} Sofort herunterfahren"
echo " ${gl__format_red}| H2 |${gl__format_off} In x Minuten herunterfahren"
echo " ${gl__format_red}| H3 |${gl__format_off} Um exakt xx:xx Uhr herunterfahren"
echo ""
echo " ${gl__format_red}NEUSTARTEN${gl__format_off}"
echo " ${gl__format_red}==========${gl__format_off}"
echo " ${gl__format_red}| N1 |${gl__format_off} Sofort neustarten"
echo " ${gl__format_red}| N2 |${gl__format_off} In x Minuten neustarten"
echo " ${gl__format_red}| N3 |${gl__format_off} Um exakt xx:xx Uhr neustarten"
echo ""
echo " ${gl__format_red}| C |${gl__format_off} Herunterfahren/Neustarten abbrechen"
echo ""
echo ""
echo "${gl__bittewaehlen}"
read shutdownreboot
case ${shutdownreboot} in
h1|H1)
bannertitel="Hauptmenü => Sofort Herunterfahren"
banner
${shutdown_bin} -P now
ende
;;
h2|H2)
bannertitel="Hauptmenü => In x Minuten Herunterfahren"
banner
read -p "${gl__format_red}Bitte eine Ganzzahl eingeben (60 oder 65 oder ...) und ENTER drücken: ${gl__format_off}" minuten
${shutdown_bin} -h ${minuten}
ende
;;
h3|H3)
bannertitel="Hauptmenü => Um exakt xx:xx Herunterfahren"
banner
read -p "${gl__format_red}Bitte eine Ganzzahl eingeben (20:31 oder 23:59 oder...) und ENTER drücken: ${gl__format_off}" ssmm
${shutdown_bin} -h ${ssmm}
ende
;;
n1|N1)
bannertitel="Hauptmenü => Sofort Neustarten"
banner
${shutdown_bin} --reboot now
ende
;;
n2|N2)
bannertitel="Hauptmenü => In x Minuten Neustarten"
banner
read -p "${gl__format_red}Bitte eine Ganzzahl eingeben (60 oder 65 oder ...) und ENTER drücken: ${gl__format_off}" minuten
${shutdown_bin} -r +${minuten}
ende
;;
n3|N3)
bannertitel="Hauptmenü => Um exakt xx:xx Neustarten"
banner
read -p "${gl__format_red}Bitte eine Ganzzahl eingeben (20:31 oder 23:59 oder...) und ENTER drücken: ${gl__format_off}" ssmm
${shutdown_bin} -r ${ssmm}
ende
;;
c|C)
bannertitel="Hauptmenü => Das geplante Herunterfahren/Neustarten abbrechen"
banner
${shutdown_bin} -c
ende
;;
esac
;;
################################################################################
### bHELPER aktualisieren
################################################################################
u|U)
bannertitel="Hauptmenü => bHELPER aktualisieren"
banner
wget https://git.disroot.org/dingens/bHELPER/raw/branch/master/bHELPER.sh -O ~/.bHELPER/bHELPER.sh
wget https://git.disroot.org/dingens/bHELPER/raw/branch/master/bHELPER.png -O ~/.bHELPER/bHELPER.png
wget https://git.disroot.org/dingens/bHELPER/raw/branch/master/README.md -O ~/.bHELPER/README.md
ende
;;
################################################################################
### Debug
################################################################################
debug)
bannertitel="Hauptmenü => Debug"
banner
bash
;;
################################################################################
### Einstellungen
################################################################################
e|E)
[[ -d "${gl__config_folder}" ]] || mkdir -p "${gl__config_folder}"
[[ -f "${gl__config_file}" ]] || touch "${gl__config_file}"
bannertitel="Hauptmenü => Einstellungen"
banner
unset desktopiconautom_status
grep -q "desktopiconautom=no" "${gl__config_file}" && desktopiconautom_status="$(echo "${gl__format_red}[ausgeschaltet]${gl__format_off}")"
grep -q "desktopiconautom=no" "${gl__config_file}" || desktopiconautom_status="$(echo "${gl__format_green}[eingeschaltet]${gl__format_off}")"
echo " ${gl__format_red}| 0 |${gl__format_off} Automatische Erstellung des Desktop Icons ${desktopiconautom_status}"
echo " ${gl__format_red}| E |${gl__format_off} Dieses Skript editieren"
echo ""
echo ""
echo "${gl__bittewaehlen}"
read einstellungen
case ${einstellungen} in
0)
bannertitel="Hauptmenü => Einstellungen => Automatisches Erstellung des Desktop Icons"
banner
if [[ "${desktopiconautom_status}" =~ .*eingeschaltet.* ]] ; then
grep -q "desktopiconautom=" "${gl__config_file}" &>/dev/null || echo "desktopiconautom=no" >> "${gl__config_file}"
sed -i "s/^desktopiconautom=.*$/desktopiconautom=no/" "${gl__config_file}"
fi
if [[ "${desktopiconautom_status}" =~ .*ausgeschaltet.* ]] ; then
grep -q "desktopiconautom=" "${gl__config_file}" &>/dev/null || echo "desktopiconautom=yes" >> "${gl__config_file}"
sed -i "s/^desktopiconautom=.*$/desktopiconautom=yes/" "${gl__config_file}"
fi
banner
grep -q "desktopiconautom=no" "${gl__config_file}" &>/dev/null && echo "Die Automatische Erstellung des Desktop Icons wurde ${gl__format_red}[ausgeschaltet]${gl__format_off}"
grep -q "desktopiconautom=yes" "${gl__config_file}" &>/dev/null && echo "Die Automatische Erstellung des Desktop Icons wurde ${gl__format_green}[eingeschaltet]${gl__format_off}"
ende
;;
e|E)
rm "${0}".dasi10 2> /dev/null
cp "${0}".dasi09 "${0}".dasi10 2> /dev/null
cp "${0}".dasi08 "${0}".dasi09 2> /dev/null
cp "${0}".dasi07 "${0}".dasi08 2> /dev/null
cp "${0}".dasi06 "${0}".dasi07 2> /dev/null
cp "${0}".dasi05 "${0}".dasi06 2> /dev/null
cp "${0}".dasi04 "${0}".dasi05 2> /dev/null
cp "${0}".dasi03 "${0}".dasi04 2> /dev/null
cp "${0}".dasi02 "${0}".dasi03 2> /dev/null
cp "${0}".dasi01 "${0}".dasi02 2> /dev/null
cp "${0}" "${0}".dasi01 2> /dev/null
nohup ${gl__fav_editor} "${0}" &
;;
esac
;;
esac
. "${gl__SkriptPfadName}" && exit 0