-1

Can you help me with writing a bash script for switching wallpaper between day and night version under XFCE? I want to set a cron job for running it so it will switch automatically based on the time of the day.

TityBoi
  • 399
  • 1
  • 4
  • 11
  • 4
    It looks like you want us to write some code for you. While many users are willing to produce code for a coder in distress, they usually only help when the poster has already tried to solve the problem on their own. A good way to demonstrate this effort is to include the code you've written so far, example input (if there is any), the expected output, and the output you actually get (console output, tracebacks, etc.). The more detail you provide, the more answers you are likely to receive. Check the [FAQ] and [ask]. – Skam Jul 22 '17 at 23:30
  • Have you already tried any of these: https://askubuntu.com/questions/380550/xubuntu-how-to-set-the-wallpaper-using-the-command-line or https://askubuntu.com/questions/414422/command-to-change-the-wallpaper-in-xubuntu those might get you started. – amo-ej1 Jul 23 '17 at 00:19

1 Answers1

0

I wrote a script:

#!/bin/bash
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s /home/maciek/Pictures/day.jpg

It works when I run it from a terminal. But when I set it up in cron it doesn't work. I get an error:

Failed to init libxfconf: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead.

Some info:

Name            : xfce4-session
Version         : 4.12.1-7
Description     : A session manager for Xfce
Architecture    : x86_64
URL             : http://www.xfce.org/
Licenses        : GPL2
Groups          : xfce4
Provides        : None
Depends On      : libxfce4ui  libwnck  libsm  polkit  xorg-iceauth  xorg-xinit  xorg-xrdb
                  polkit-gnome  hicolor-icon-theme
Optional Deps   : gnome-keyring: for keyring support when GNOME compatibility is enabled
                  xscreensaver: for locking screen with xflock4
                  gnome-screensaver: for locking screen with xflock4
                  xlockmore: for locking screen with xflock4
                  slock: for locking screen with xflock4
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : xfce-utils
Installed Size  : 1972.00 KiB
Packager        : Evangelos Foutras <evangelos@foutrelis.com>
Build Date      : Tue 27 Jun 2017 05:48:04 AM CEST
Install Date    : Fri 21 Jul 2017 11:49:41 PM CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature


DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
TityBoi
  • 399
  • 1
  • 4
  • 11
  • That's not an answer, but an update to your question. Have a look: https://unix.stackexchange.com/a/28496 – AndreLDM Jul 30 '17 at 22:47