diff --git a/scripts/getMadame.sh b/scripts/getMadame.sh index 2e79c97..6be6eb2 100755 --- a/scripts/getMadame.sh +++ b/scripts/getMadame.sh @@ -8,13 +8,36 @@ # Link : http://www.magetys.com # Version : 1.0.1 # Dependency : libnotify-bin +# Optionnal : imagemagick # Note : Works on Gnome and Xfce # ########################################### page= +set -x +function usage { + script_name=`basename "$0"` + echo "Usage $script_name [Day]" + echo "Day to displae (1 for today, 2 for yesterday, 3 for the day before ...)" +} + + +function is_a_number { + if echo $1 | grep '^[0-9]+$' &> /dev/null + then + return 0 + else + return 1 + fi +} + if [ $# != 0 ] then + if is_a_number $1 ; + then + usage + exit + fi page="/page/${1}" fi @@ -42,7 +65,13 @@ function fixdbus { function resize { # Get screen size - res=$(xdpyinfo | grep dimensions | awk '{print $2}') + res= + if [ -e /usr/bin/xrandr ]; + then + res=$(xrandr | tail -1 | awk '{print $1}') + else + res=$(xdpyinfo | grep dimensions | awk '{print $2}') + fi tailleX=$(echo $res | awk -F "x" '{print $1}'); tailleY=$(echo $res | awk -F "x" '{print $2}'); echo "Screen Size is X: $tailleX, Y: $tailleY"