diff --git a/Utils/octopus.sh b/Utils/octopus.sh index 4d6416b..7e47fb8 100755 --- a/Utils/octopus.sh +++ b/Utils/octopus.sh @@ -1,5 +1,6 @@ #!/bin/bash +#OCTOPUS=~/Programmation/Utils/octopus.sh #This octopus handles all the actions like volume up, refresh status bar, etc.. if [ $# -lt 1 ] @@ -19,7 +20,7 @@ case $1 in amixer -q set Master 5%- unmute ;; "mute") - amixer -q set Master toogle + amixer -q set Master toggle ;; esac $0 refresh @@ -45,13 +46,30 @@ case $1 in ;; "refresh") - # blah blah - echo "blah!" + DATE=`date +"%F, %H:%M:%S - %s"` + BATT=$( acpi -b | sed 's/.*[charg.|], \([0-9]*\)%.*/\1/gi' ) + VOLUME=`amixer get Master | tail -n 2 | head -n 1 | cut -d' ' -f7` + MEM=`awk '/MemTotal/ {printf( "%.0fMb", $2 / 1024 )}' /proc/meminfo` + + xsetroot -name "$VOLUME :: $MEM :: $BATT :: $DATE" ;; "wallpaper") - # blah blah - echo "changing the wallpaper!" + ~/Pictures/wallpapers/chooseWP.sh & ;; + "init-all") + + xrandr | grep "VGA1 disconnected" > /dev/null + if [ $? -eq 0 ] + then + $0 monitor laptop + else + $0 monitor extern + fi + + $0 wallpaper + esac + +# vim: ts=4 diff --git a/bashrc b/bashrc index c90b0bd..bc7b79f 100644 --- a/bashrc +++ b/bashrc @@ -88,10 +88,20 @@ alias makew='make' alias BSI2='cd ~/Documents/UniGE/BSI2*/' -MONITOR_PATH=~/Programmation/Utils/monitor.sh -alias dual='$MONITOR_PATH dual' -alias laptop='$MONITOR_PATH laptop' -alias extern='$MONITOR_PATH extern' +OCTOPUS=~/Programmation/Utils/octopus.sh +alias dual='$OCTOPUS monitor dual' +alias laptop='$OCTOPUS monitor laptop' +alias extern='$OCTOPUS monitor extern' + +alias volup='$OCTOPUS volume up' +alias voldown='$OCTOPUS volume down' +alias volmute='$OCTOPUS volume mute' + + +#MONITOR_PATH=~/Programmation/Utils/monitor.sh +#alias dual='$MONITOR_PATH dual' +#alias laptop='$MONITOR_PATH laptop' +#alias extern='$MONITOR_PATH extern' #alias 'make celan'='make clean' diff --git a/xinitrc b/xinitrc index cadb59b..6cca8aa 100644 --- a/xinitrc +++ b/xinitrc @@ -13,22 +13,18 @@ fi #DWM -#First, choose the wallpaper (important, isn't it ? :p) -~/Pictures/wallpapers/chooseWP.sh & +export PATH=~/Programmation/Utils/:$PATH + +source ~/.bashrc + +$OCTOPUS init-all #Java wmname LG3D while true; do - DATE=`date +"%F, %H:%M:%S - %s"` - BATT=$( acpi -b | sed 's/.*[charg.|], \([0-9]*\)%.*/\1/gi' ) -# STATUS=$( acpi -b | sed 's/.*: \([a-zA-Z]*\),.*/\1/gi' ) - VOLUME=`amixer get Master | tail -n 2 | head -n 1 | cut -d' ' -f7` - MEM=`awk '/MemTotal/ {printf( "%.0fMb", $2 / 1024 )}' /proc/meminfo` - - - xsetroot -name "$VOLUME :: $MEM :: $BATT :: $DATE" + $OCTOPUS refresh sleep 2 done &