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

set wallpaper doesn't work #23

Closed
SevenOutman opened this issue Jun 5, 2017 · 7 comments
Closed

set wallpaper doesn't work #23

SevenOutman opened this issue Jun 5, 2017 · 7 comments

Comments

@SevenOutman
Copy link

SevenOutman commented Jun 5, 2017

My script looks like this:

wallpaper.set(fullImagePath).then(() => {
  console.log('Set as wallpaper')
  wallpaper.get().then(imagePath => {
       console.log(`Current wallpaper: ${imagePath}`)
  })
})

which is run by crontab on Ubuntu 16.04 (with GNOME).
The wallpaper doesn't change, and the logged imagePath does not equal fullImagePath.
The output was like:

Image already downloaded at: /home/doma/scripts/bing-wallpaper-script/downloads/20170605.jpg
Set as wallpaper
Current wallpaper: /usr/share/backgrounds/warty-final-ubuntu.png

However when I run this script manually (not invoke by crontab), it works fine.

@fa7ad
Copy link
Contributor

fa7ad commented Jun 5, 2017

Could it be a problem with the user being used to execute the commands from crontab?

@SevenOutman
Copy link
Author

@fa7ad Not really. I run crontab as the same user with that when I run my script manually. By the way, if set method fails on user permission, I think its Promise should have been rejected.

@fa7ad
Copy link
Contributor

fa7ad commented Jun 30, 2017

FWIW, can you try running the script through a nodejs script?

setInterval(() => {
  wallpaper.set(...)
}, 60000)

and keeping that running (like a daemon)

@SevenOutman
Copy link
Author

@fa7ad Thanks, your approach may work. However, it's not actually my final goal to change wallpaper at an interval. I was trying to run my script upon system wakeup (Ubuntu has hooks for that), but it didn't work. So I tried running my script with crontab, but it didn't work as well. I guess these 2 scenarios have a same cause, so I only mentioned the crontab scenario in this issue for easier understanding.

@fa7ad
Copy link
Contributor

fa7ad commented Jul 18, 2017

@SevenOutman If your goal is to run at startup, try creating a .desktop file at ~/.config/autostrart or using a systemd service (just set the user and group options)

@SevenOutman
Copy link
Author

@fa7ad Thanks for your advice. But I want to run my script at wakeup, not startup.

@fa7ad
Copy link
Contributor

fa7ad commented Jul 19, 2017

@SevenOutman sorry, missed that. well, good luck

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

3 participants