Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image not showing up in Ubuntu 16.04 #83

Closed
relentless-coder opened this issue Sep 20, 2016 · 8 comments
Closed

Image not showing up in Ubuntu 16.04 #83

relentless-coder opened this issue Sep 20, 2016 · 8 comments

Comments

@relentless-coder
Copy link

I followed every step as described in the installation process, but nothing happened. The is installed, I have looked into the directory, but the desktop background didn't change.

@soohyunc
Copy link

soohyunc commented Dec 4, 2016

yup, this is true. the background image did not change automatically with crontab configuration, but only worked with manual run on terminal. why?

@ngrande
Copy link

ngrande commented Dec 7, 2016

cron only has access to a very restricted set of environment variables - the python script here makes use of one that is not available in that case.

see SO answer here:
https://stackoverflow.com/questions/10374520/gsettings-with-cron/19666729#19666729

@boramalper
Copy link
Owner

Hey,

I tried and experienced the problem myself as well, although I didn't encounter it before (not sure if they changed the behaviour of services [if not, then how did it work for so long?]).

Anyway, not only the script makes use of environment variables but also gsettinngs (on $DISPLAY) which himawaripy heavily relies on. I'm trying to find a way without hard-coding environment variables, but it might be our last resort.

@soohyunc
Copy link

soohyunc commented Feb 5, 2017

i have managed to fix this issue as a walk-around approach. basically, the link that @ngrande shared above helped a lot.

that is, i have created a separate shell script as the below, and added in my crontab with the same period as the himawaripy executable file. this seemed to work very well so far.

#!/bin/bash
# http://bit.ly/2ines3u

# Wallpaper's directory.
dir="${HOME}/.cache/himawaripy/"

# export DBUS_SESSION_BUS_ADDRESS environment variable
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ | cut -d= -f2-)

# Random wallpaper.
wallpaper=`find "${dir}" -type f | shuf -n1`

# Change wallpaper.
# http://bit.ly/HYEU9H
gsettings set org.gnome.desktop.background picture-options "spanned"
gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}"

@zenithyr
Copy link

zenithyr commented May 5, 2018

above approach by @soohyunc is totally working. One suggestion is to change the "spanned" to "scaled" in order to center the image.

Thanks!

@raphaelbs
Copy link

@soohyunc answer should be in README. Thank you!

@boramalper
Copy link
Owner

Fixed! You should now be able to use it as described in the README without any additional scripts. Let me know if you have any further questions. =)

@zzbajie
Copy link

zzbajie commented Jan 12, 2022

OR PID=$(pgrep gnome-session | head -n1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants