67 lines
1.3 KiB
Bash
Executable File
67 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
## wallpaper in .png or .xbm. External variable file dependent colors ##
|
|
# wallpaper.sh by @root_informatica.
|
|
|
|
. $HOME/.config/wms/wms_var
|
|
|
|
FLAG=$1
|
|
# wallpaper path.
|
|
WALL="$HOME/.wall.png"
|
|
# bitmap path.
|
|
BITMAP="$HOME/.bitmap.xbm"
|
|
# image target.
|
|
TARGET=$2
|
|
# screen resolution.
|
|
RES=$(sed 's/,/x/' < /sys/class/graphics/fb0/virtual_size)
|
|
|
|
# makes a bitmap of the given image and sets it as wallpaper
|
|
bitmap() {
|
|
convert $TARGET -negate -resize "!$RES" $BITMAP
|
|
xsetroot -fg "#$AC" -bg "#$BC" -bitmap $BITMAP
|
|
}
|
|
|
|
# pixelate the given image and set it as wallpaper
|
|
pixel() {
|
|
convert -scale 10% -scale 1000% $TARGET $WALL
|
|
display -resize "!$RES" -window root $WALL
|
|
}
|
|
|
|
# copy the given image and set it as wallpaper
|
|
wall() {
|
|
cp $TARGET $WALL
|
|
display -resize "!$RES" -window root $WALL
|
|
}
|
|
|
|
# let's proceed with the given images
|
|
if [ -n "$TARGET" ]; then
|
|
if [ -f "$TARGET" ]; then
|
|
case $FLAG in
|
|
-b)
|
|
bitmap
|
|
;;
|
|
-p)
|
|
pixel
|
|
;;
|
|
-w)
|
|
wall
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
else # if the name of an image is not passed as the second argument
|
|
case $FLAG in
|
|
-b) # just bitmap.xbm to desktopk
|
|
if [ -f "$BITMAP" ]; then
|
|
xsetroot -fg "#$AC" -bg "#$BC" -bitmap $BITMAP
|
|
fi
|
|
;;
|
|
-w) # just wall.png to desktop
|
|
if [ -f "$WALL" ]; then
|
|
display -resize "!$RES" -window root $WALL
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
|