Uhr und Batteriestatus auf der Seitenleiste installieren

Dieses Skript installiert eine Uhr und eine Batterie-Status-Anzeige auf der rechten Seitenleiste. Es automatisiert die Schritte, die unter Seitenpanel anpassen beschrieben sind.

Unter Ausführen von Skripten wird erklärt wie Skripte richtig verwendet werden.

Ausführen als root!

install-panel-clock.sh


 * 1) !/bin/bash


 * 1) panel clock installer by hamstiglue
 * 2) install clock and battery status on the wetab side panel:
 * 3) install-panel-clock.sh [-u] [ ]
 * 4) * -u   uninstalls the clock/battery status and restores the help button
 * 1) install-panel-clock.sh [-u] [ ]
 * 2) * -u   uninstalls the clock/battery status and restores the help button
 * 1) * -u   uninstalls the clock/battery status and restores the help button
 * 1) * -u   uninstalls the clock/battery status and restores the help button

if [ $UID -gt 0 ] ; then echo "please run as root" exit 1; fi

if [ $UID -gt 0 ] ; then USERNAME=$USER else source /var/tiitoo/registration/device_registered fi

if [ "$1" == "-u" ] ; then UNINSTALL=1 shift else UNINSTALL=0 fi

NR=1 GTKRC=/usr/share/themes/WeTab/gtk-2.0/gtkrc KIOSKRC=/etc/xdg/xfce4/kiosk/kioskrc USERPANELPATH=/home/$USERNAME/.config/xfce4/panel USERPANEL=$USERPANELPATH/panels.xml GLOBALPANEL=/etc/xdg/xfce4/panel/panels.xml WIDESEPITEM='         ' DEFAULTSEPITEM='         ' SMALLSEPITEM='         ' SMALLSEPFILE=$USERPANELPATH/ttseparator-small.rc SMALLSEPRC='Icon=/usr/share/pixmaps/tiitoo/panel/ttseparator/ttseparator.png\nIconHeight=4' GTKSTYLE='\nstyle "panel"\n{\n font_name = "Droid Sans 18"\n  fg [NORMAL] = "white"\n  bg [NORMAL] = "#313131"\n}\nwidget "*Panel*" style "panel"\n' CLOCKRC='ClockType=2\nShowFrame=false\nShowSeconds=false\nShowMilitary=false\nShowMeridiem=false\nTrueBinary=false\nFlashSeparators=false\nDigitalFormat=%R' CLOCKFILE=$USERPANELPATH/clock-default.rc CLOCKITEM='' BATTMONRC='display_label=false\ndisplay_icon=false\ndisplay_power=false\ndisplay_percentage=false\ndisplay_time=false\ntooltip_display_percentage=true\ntooltip_display_time=true\nlow_percentage=10\ncritical_percentage=5\naction_on_low=0\naction_on_critical=0\nhide_when_full=0\ncommand_on_low=\ncommand_on_critical=' BATTMONFILE=$USERPANELPATH/battmon-default.rc BATTMONITEM='' CLOCKPOS="$1" BATTMONPOS="$2"

if [ -z "$CLOCKPOS" ] ; then CLOCKPOS="1" fi

if [ -z "$BATTMONPOS" ] ; then BATTMONPOS="2" fi

if [ "$CLOCKPOS" -eq "$BATTMONPOS" ] && [ $BATTMONPOS -gt 0 ] ; then BATTMONPOS="$(($BATTMONPOS + 1))" fi

mkdir -p $(dirname $USERPANEL) chown $USERNAME.$USERNAME $(dirname $USERPANEL) chmod 775 $(dirname $USERPANEL)

echo -e "$CLOCKRC" > $CLOCKFILE echo -e "$BATTMONRC" > $BATTMONFILE echo -e "$SMALLSEPRC" > $SMALLSEPFILE perl -pi -e 's/^(CustomizePanel=\%root)$/$1,'$USERNAME'/' $KIOSKRC if grep 'style \"panel\"' $GTKRC >/dev/null 2>&1 ; then true else echo -e "$GTKSTYLE" >> $GTKRC fi

cat $GLOBALPANEL | grep -B 20 ' ' > $USERPANEL echo "$DEFAULTSEPITEM" >> $USERPANEL

WIDESEP=0 SMALLSEP=0 echo 'EOF' |cat $GLOBALPANEL - | egrep '(/dev/null 2>&1 ; then WIDESEP=2 fi

if [ "$OUTPUT" != "EOF" ] ; then if [ $SMALLSEP -gt 0 ] ; then SMALLSEP="$(($SMALLSEP - 1))" echo "$SMALLSEPITEM" >> $USERPANEL else if [ $WIDESEP -gt 0 ] ; then echo "$WIDESEPITEM" >> $USERPANEL else echo "$DEFAULTSEPITEM" >> $USERPANEL fi     fi      if [ $WIDESEP -gt 0 ] ; then WIDESEP="$(($WIDESEP - 1))" fi     echo "          $OUTPUT" >> $USERPANEL fi   if [ "$LINE" == "EOF" ] && ( [ $NR -lt $CLOCKPOS ] || [ $NR -lt $BATTMONPOS ] ) ; then REPEAT=1 fi   NR="$(($NR + 1))" done done echo "$WIDESEPITEM" >> $USERPANEL cat $GLOBALPANEL | grep -A 20 ' ' >> $USERPANEL

chown $USERNAME.$USERNAME $USERPANELPATH/* chmod 664 $USERPANELPATH/*

if [ $UNINSTALL -gt 0 ] ; then rm $USERPANELPATH/* fi

killall -9 xfce4-panel sleep 1 killall tiitoo-pinnwand killall tiitoo-expose