„bHELPER.sh“ ändern

This commit is contained in:
dingens 2021-01-26 16:22:37 +00:00
parent 0e8f1db70d
commit c9b1f02d19
1 changed files with 217 additions and 1 deletions

View File

@ -12,4 +12,220 @@ gl__osname_version=$(grep -o "openSUSE\|Fedora\|Ubuntu 14.04" /etc/os-release |
gl__ipv4wlan=$(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\}")
[[ -d ${HOME}/Desktop/ ]] && gl__Desktop_VZ=Desktop/
[[ -d ${HOME}/Schreibtisch/ ]] && gl__Desktop_VZ=Schreibtisch/
[[ -d ${HOME}/Schreibtisch/ ]] && gl__Desktop_VZ=Schreibtisch/
################################################################################
### Optik
################################################################################
gl__format_red=$(echo -e "\033[1;31m")
gl__format_green=$(echo -e "\033[1;32m")
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__trennlinie=$(echo "${gl__format_red}----------------------------------------------------------------------------------------------------------------------------------------------------------${gl__format_off}")
gl__bittewaehlen=$(echo " ${gl__format_red}BITTE WÄHLEN!${gl__format_off}")
################################################################################
### Verzeichnisse
################################################################################
gl__startseite_vz=".Startseite/"
################################################################################
### 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/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
################################################################################
### 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}')
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")
### ♫♪♩♬
gl__clementine_anaus=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Identity | grep -o Clementine)
if [ ${gl__clementine_anaus} = "Clementine" ] ; then
gl__clementine_vars="${0}.clementine.tmp"
qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata > "${gl__clementine_vars}"
gl__artist=$(grep "xesam:artist" "${gl__clementine_vars}" | sed "s/xesam:artist: //")
gl__title=$(grep "xesam:title" "${gl__clementine_vars}" | sed "s/xesam:title: //")
gl__genre=$(grep "xesam:genre" "${gl__clementine_vars}" | sed "s/xesam:genre: //")
fi
function bannerstart {
echo -e ""
echo -e " ${gl_format_red}888 888 888 8888888888 888 8888888b. 8888888888 8888888b. ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 Y88b 888 888 Y88b ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 888 888 888 888 ${gl_format_off}"
echo -e " ${gl_format_red}88888b. 8888888888 8888888 888 888 d88P 8888888 888 d88P ${gl_format_off}"
echo -e " ${gl_format_red}888 \"88b 888 888 888 888 8888888P\" 888 8888888P\" ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 888 888 888 T88b ${gl_format_off}"
echo -e " ${gl_format_red}888 d88P 888 888 888 888 888 888 888 T88b ${gl_format_off}"
echo -e " ${gl_format_red}88888P\" 888 888 8888888888 88888888 888 8888888888 888 T88b ${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}"
echo -e " ${gl__format_red}EN:${gl__format_off} ${gl__ipv4_eth} ${gl__format_red}WLAN:${gl__format_off} ${gl__wlanactive} ${gl__format_red}WLAN IP:${gl__format_off} ${gl__ipv4wlan}"
echo -e " ${gl__format_red}Pfad:${gl__format_off} ${gl__SkriptPfadName}"
echo -e " ${gl__format_red}OS:${gl__format_off} ${gl__os} ${gl__format_red}Host:${gl__format_off} ${HOSTNAME}"
echo -e " ${gl__format_red}Lüfterdrehzahl:${gl__format_off} ${fanspeed} ${gl__format_red}CPU:${gl__format_off} ${core0temp} ${core1temp} ${core2temp} ${core3temp} ${core4temp} ${core5temp} ${core6temp} ${core7temp}"
[[ "${gl__clementine_anaus}" = "Clementine" ]] && echo -e " ${gl__format_red}♫♪♩♬:${gl__format_off} ${gl__artist} - ${gl__title} ${gl__format_red}Genre:${gl__format_off} ${gl__genre}"
}
function banner {
clear
echo -e ""
echo -e " ${gl_format_red}888 888 888 8888888888 888 8888888b. 8888888888 8888888b. ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 Y88b 888 888 Y88b ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 888 888 888 888 ${gl_format_off}"
echo -e " ${gl_format_red}88888b. 8888888888 8888888 888 888 d88P 8888888 888 d88P ${gl_format_off}"
echo -e " ${gl_format_red}888 \"88b 888 888 888 888 8888888P\" 888 8888888P\" ${gl_format_off}"
echo -e " ${gl_format_red}888 888 888 888 888 888 888 888 888 T88b ${gl_format_off}"
echo -e " ${gl_format_red}888 d88P 888 888 888 888 888 888 888 T88b ${gl_format_off}"
echo -e " ${gl_format_red}88888P\" 888 888 8888888888 88888888 888 8888888888 888 T88b ${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 {
echo -e ""
echo -e ""
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 " ${gl__format_red}| 0 |${gl__format_off} hello world ${gl__format_red}| X |${gl__format_off} Sonstiges"
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 ""
echo "${gl__bittewaehlen}"
read -n 1 hauptmenue
case ${hauptmenue} in
################################################################################
### Bildschirm sperren
################################################################################
1)
if [[ ${WINDOWMANAGER} =~ .*plasma.* ]]
then
dbus-send --type=method_call --dest=org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.Lock
fi
if [[ ${WINDOWMANAGER} =~ .*xfce.* ]]
then
xscreensaver-command -lock
#i3lock --image=/home/${USER}/1\ WD/IT/Hintergrundbilder/Borussia\ Mönchengladbach\ 1366x768.png -t
fi
;;
################################################################################
### SKRIPT EDITIEREN (Anfang)
################################################################################
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
cat <<_EOF_ > ~/${gl__Desktop_VZ}bHELPER.desktop
[Desktop Entry]
Name=bHELPER
Icon=/home/${USER}/.bHELPER/bHELPER.png
Exec=bash '/home/${USER}/.bHELPER/bHELPER.sh'
Type=Application
Terminal=true
_EOF_
chmod 755 ~/${gl__Desktop_VZ}bHELPER.desktop
rm /home/${USER}/nohup.out 2> /dev/null
rm "${0}".*.tmp 2> /dev/null
. "${gl__SkriptPfadName}" && exit 0