[bonjourmadame] resize to screen resolution
This commit is contained in:
parent
22ada08b14
commit
660c380b8d
@ -34,6 +34,34 @@ function fixdbus {
|
|||||||
echo Dbus fixed OK
|
echo Dbus fixed OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resize {
|
||||||
|
# Get screen size
|
||||||
|
res=$(xdpyinfo | grep dimensions | awk '{print $2}')
|
||||||
|
tailleX=$(echo $res | awk -F "x" '{print $1}');
|
||||||
|
tailleY=$(echo $res | awk -F "x" '{print $2}');
|
||||||
|
# Get image size
|
||||||
|
res=$(identify -format '%w %h\n' $1)
|
||||||
|
imgX=$(echo $res | awk '{print $1}')
|
||||||
|
imgY=$(echo $res | awk '{print $2}')
|
||||||
|
echo "Original Image Size is X: $imgX, Y: $imgY"
|
||||||
|
# Calculate resize factor
|
||||||
|
rapX=$(($tailleX*1000/$imgX))
|
||||||
|
rapY=$(($tailleY*1000/$imgY))
|
||||||
|
echo "Screen Size is X: $tailleX, Y: $tailleY"
|
||||||
|
mult=0
|
||||||
|
div=0
|
||||||
|
if [ $rapX -gt $rapY ];
|
||||||
|
then
|
||||||
|
mult=$tailleX
|
||||||
|
div=$imgX
|
||||||
|
else
|
||||||
|
mult=$tailleY
|
||||||
|
div=$imgY
|
||||||
|
fi
|
||||||
|
res=$((($imgX*$mult)/$div))'x'$((($imgY*$mult)/$div))
|
||||||
|
echo "New size is $res"
|
||||||
|
`mogrify -resize $res $1`;
|
||||||
|
}
|
||||||
|
|
||||||
# please install libnotify-bin to popup notification
|
# please install libnotify-bin to popup notification
|
||||||
function notify {
|
function notify {
|
||||||
@ -61,16 +89,24 @@ wget -O - http://www.bonjourmadame.fr | grep -Eo "(http://www.bonjourmadame.fr/p
|
|||||||
echo Photo downloaded OK
|
echo Photo downloaded OK
|
||||||
|
|
||||||
ls $fileprefix* | sort -r | tail -n +2 | xargs rm -f
|
ls $fileprefix* | sort -r | tail -n +2 | xargs rm -f
|
||||||
|
if [[ -e /usr/bin/identify ]]
|
||||||
|
then
|
||||||
|
resize $todaywp;
|
||||||
|
echo Photo Resize OK;
|
||||||
|
fi
|
||||||
|
|
||||||
fixdbus
|
fixdbus
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -e /usr/bin/feh ]]
|
||||||
|
then
|
||||||
|
feh --bg-center $todaywp
|
||||||
|
fi
|
||||||
if [[ -e /usr/bin/xfconf-query ]]
|
if [[ -e /usr/bin/xfconf-query ]]
|
||||||
then
|
then
|
||||||
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $todaywp
|
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $todaywp
|
||||||
elif [[ -e /usr/bin/feh ]]
|
fi
|
||||||
then
|
if [[ -e /usr/bin/gconftool-2 ]]
|
||||||
feh --bg-scale $todaywp
|
|
||||||
elif [[ -e /usr/bin/gconftool-2 ]]
|
|
||||||
then
|
then
|
||||||
gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp
|
gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user