File: xfce4-set-wallpaper

package info (click to toggle)
xapp 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,688 kB
  • sloc: ansic: 11,268; python: 1,463; xml: 258; sh: 22; makefile: 9
file content (23 lines) | stat: -rwxr-xr-x 668 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

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

# xfce4-desktop requires an absolute path.
wallpaper="$(realpath "$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