Wallpaper script supports color, no longer sources conf file
This commit is contained in:
parent
720ddd3d99
commit
03290f61e7
@ -1,9 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
if type "$XMD_USERDIR/wallpaper" > /dev/null; then
|
||||
. "$XMD_USERDIR/wallpaper"
|
||||
name=`basename "$0"`
|
||||
configFilePath="$XMD_USERDIR/wallpaper"
|
||||
|
||||
if type xwallpaper > /dev/null; then
|
||||
isInstalled() {
|
||||
type "$1" > /dev/null
|
||||
}
|
||||
|
||||
shouldHaveInstalled() {
|
||||
if ! isInstalled "$1"; then
|
||||
echo "$name: $1 is not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage: $name" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
[ "$#" -gt 0 ] && usage
|
||||
|
||||
if type "$configFilePath" > /dev/null; then
|
||||
color="black"
|
||||
|
||||
while read -r line; do
|
||||
IFS="=" read key value << EOF
|
||||
$line
|
||||
EOF
|
||||
case "$key" in
|
||||
"mode") mode="$value";;
|
||||
"file") file="$value";;
|
||||
"color") color="$color";;
|
||||
*) echo "$name: bad key $key in $configFilePath" >&2;;
|
||||
esac
|
||||
done < "$configFilePath"
|
||||
|
||||
case "$mode" in
|
||||
"" | center | focus | maximize | stretch | tile | zoom) ;;
|
||||
*)
|
||||
echo "$name: bad mode $mode" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n color ] && shouldHaveInstalled xsetroot && \
|
||||
xsetroot -solid "$color"
|
||||
[ -n mode ] && shouldHaveInstalled xwallpaper && \
|
||||
xwallpaper "--${mode}" "$file"
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user