Codebase list xapp / debian/1.0.3-2 files / usr / bin / xfce4-set-wallpaper
debian/1.0.3-2

Tree @debian/1.0.3-2 (Download .tar.gz)

xfce4-set-wallpaper @debian/1.0.3-2raw · history · blame

#!/bin/bash

# Author: Weitian Leung <weitianleung@gmail.com>
# Version: 2.0
# License: GPL-3.0
# Description: set a picture as xfce4 wallpaper

wallpaper=$1

# check image
mime_type=`file --mime-type -b "$wallpaper"`
if [[ ! "$mime_type" == image/* ]]; then
        echo "Invalid image"
        exit 1
fi

# set to every monitor that contains image-path/last-image
properties=$(xfconf-query -c xfce4-desktop -p /backdrop -l | grep -e "screen.*/monitor.*image-path$" -e "screen.*/monitor.*/last-image$")

for property in $properties; do
        xfconf-query -c xfce4-desktop -p $property -s "$wallpaper"
done