2013-06-11 20:39:53 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2013-06-11 21:26:08 +00:00
|
|
|
#OCTOPUS=~/Programmation/Utils/octopus.sh
|
2013-06-11 20:39:53 +00:00
|
|
|
#This octopus handles all the actions like volume up, refresh status bar, etc..
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]
|
|
|
|
then
|
2013-07-01 20:56:32 +00:00
|
|
|
echo "Usage : $0 [vol up|vol down|refresh|monitor extern|monitor laptop|monitor dual...]"
|
2013-06-11 20:39:53 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
|
|
|
|
"vol"|"volume")
|
|
|
|
case $2 in
|
|
|
|
"up")
|
|
|
|
amixer -q set Master 5%+ unmute
|
|
|
|
;;
|
|
|
|
"down")
|
|
|
|
amixer -q set Master 5%- unmute
|
|
|
|
;;
|
|
|
|
"mute")
|
2013-06-11 21:26:08 +00:00
|
|
|
amixer -q set Master toggle
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
$0 refresh
|
|
|
|
;;
|
|
|
|
|
|
|
|
"monitor")
|
|
|
|
case $2 in
|
|
|
|
"extern")
|
|
|
|
xrandr --output LVDS1 --off \
|
|
|
|
--output VGA1 --auto --rotate normal
|
|
|
|
;;
|
|
|
|
"laptop")
|
|
|
|
xrandr --output LVDS1 --auto --rotate normal \
|
|
|
|
--output VGA1 --off
|
|
|
|
;;
|
|
|
|
"dual")
|
|
|
|
xrandr --output LVDS1 --auto --rotate normal \
|
|
|
|
--output VGA1 --auto --rotate normal \
|
|
|
|
--right-of LVDS1
|
|
|
|
;;
|
2013-06-14 17:13:19 +00:00
|
|
|
"off")
|
|
|
|
xset dpms force off
|
|
|
|
;;
|
2013-06-11 20:39:53 +00:00
|
|
|
esac
|
|
|
|
$0 wallpaper
|
|
|
|
;;
|
|
|
|
|
|
|
|
"refresh")
|
2013-07-07 13:06:43 +00:00
|
|
|
DATE=`date +"%A %d, %Hh%M - %s"`
|
2013-06-25 23:22:52 +00:00
|
|
|
BATT_PCT=$(acpi -b | cut -d, -f2 | cut -d" " -f2)
|
|
|
|
BATT_TIME=$(acpi -b | cut -d, -f3 | cut -d" " -f2)
|
|
|
|
#BATT=$( acpi -b | sed 's/.*[charg.|], \([0-9]*\)%.*/\1/gi' )
|
2013-06-11 21:26:08 +00:00
|
|
|
VOLUME=`amixer get Master | tail -n 2 | head -n 1 | cut -d' ' -f7`
|
|
|
|
|
2013-07-18 15:29:28 +00:00
|
|
|
MEMFREE=`awk '/MemFree/ {printf( "%.0f", $2 / 1024 )}' /proc/meminfo`
|
|
|
|
MEMCACHED=`awk '/Cached/ {printf( "%.0f", $2 / 10240 )}' /proc/meminfo`
|
|
|
|
MEMFT=`echo "$MEMFREE + $MEMCACHED" | bc`
|
|
|
|
|
|
|
|
xsetroot -name "Vol $VOLUME :: $MEMFT Mb Free :: Bat $BATT_PCT $BATT_TIME :: $DATE"
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"wallpaper")
|
2013-06-11 21:26:08 +00:00
|
|
|
~/Pictures/wallpapers/chooseWP.sh &
|
2013-06-11 20:39:53 +00:00
|
|
|
;;
|
|
|
|
|
2013-06-11 21:26:08 +00:00
|
|
|
"init-all")
|
|
|
|
xrandr | grep "VGA1 disconnected" > /dev/null
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
$0 monitor laptop
|
|
|
|
else
|
|
|
|
$0 monitor extern
|
|
|
|
fi
|
|
|
|
|
|
|
|
$0 wallpaper
|
2013-06-14 17:13:19 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
"suspend")
|
|
|
|
systemctl suspend
|
|
|
|
xlock -mode blank
|
2013-06-11 21:26:08 +00:00
|
|
|
|
2013-06-11 20:39:53 +00:00
|
|
|
esac
|
2013-06-11 21:26:08 +00:00
|
|
|
|
|
|
|
# vim: ts=4
|