marguerite / linux-bing-wallpaper Goto Github PK
View Code? Open in Web Editor NEWset Bing Wallpaper of the Day as your Linux Desktop's wallpaper
set Bing Wallpaper of the Day as your Linux Desktop's wallpaper
In Ubuntu /bin/bash links to dash. For me the scripts only work if I change the first line to /bin/bash. If one runs the script as sh in Ubuntu there are errors on some specific bash syntax like the double square brackets for conditional statements.
var (
markets = []string{"en-US", "zh-CN", "ja-JP", "en-AU", "en-UK", "de-DE", "fr-FR", "en-NZ", "en-CA"}
resolutions = []string{"1920x1200", "1920x1800", "1366x768", "1280x768", "1280x720", "1024x768"}
)
The second candidate in the list should be "1920x1080", otherwise we will fall back to the lower resolution of "1366x768".
Thanks a lot for your application. I enjoyed and appreciated it!
I get the following error message on stderr: "Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'evaluateScript' in interface 'org.kde.PlasmaShell' at object path '/PlasmaShell' (signature 's')"
I have Kubuntu 16.04 LTS with Plasma v5.5.5
What would be the minimum plasma version that has the method evaluateScript?
Under install golang section
export GO111MODULE=ON
should be replaced with export GO111MODULE=on
Can not run with systemctl --user start bing-wallpaper.service as README mentioned
status from systemctl --user status bing-wallpaper.service
Process: 1389 ExecStart=/workspace/projects/linux-bing-wallpaper/bing-wallpaper zh-CN true (code=exited, status=2)
Main PID: 1389 (code=exited, status=2)Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Service hold-off time over, scheduling restart.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Scheduled restart job, restart counter is at 5.
Mar 04 18:27:47 ooxx systemd[476]: Stopped Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Start request repeated too quickly.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Failed with result 'exit-code'.
Mar 04 18:27:47 ooxx systemd[476]: Failed to start Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
logs from journalctl --user-unit bing-wallpaper.service
Mar 04 18:27:45 ooxx systemd[476]: Started Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: panic: strconv.ParseBool: parsing "": invalid syntax
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: goroutine 1 [running]:
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.check(0x6d76e0, 0xc420086d20)
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:26 +0x4a
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.detect_de(0x92b9bcca1072ffa6, 0x8)
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:57 +0x522
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.main()
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:359 +0x74
Mar 04 18:27:45 ooxx systemd[476]: bing-wallpaper.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 04 18:27:45 ooxx systemd[476]: bing-wallpaper.service: Failed with result 'exit-code'.
Mar 04 18:27:46 ooxx systemd[476]: bing-wallpaper.service: Service hold-off time over, scheduling restart.
Mar 04 18:27:46 ooxx systemd[476]: bing-wallpaper.service: Scheduled restart job, restart counter is at 1.
Mar 04 18:27:46 ooxx systemd[476]: Stopped Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
It seems that go can't get XDG_CURRENT_DESKTOP env when starts from systemd because I do have that env (XDG_CURRENT_DESKTOP=XFCE), it works when run the binary directly. LoL
OS: ArchLinux x64 with xfce4 desktop
Is it possible to make the script work with Unity ?
On ~50% of the days the actual image downloaded is not the picture of the day but a picture of a tropical island as seen on the screenshot.
The screenshot is done with the commit: c69f79f
The script is stared with the following command:
$ DESKTOP_SESSION=WM ./bing-wallpaper -market=en-US
Im getting this error on Kubuntu 16.04. Changing first line to bash doesnt help
Is there a minimum version of Go required to build this? I get the following compile errors running on RHEL7 with go1.3.3 (which comes from the RHEL7 repo):
[xpi@localhost linux-bing-wallpaper]$ go build bing-wallpaper.go
# command-line-arguments
./bing-wallpaper.go:458: syntax error: unexpected range, expecting {
./bing-wallpaper.go:474: non-declaration statement outside function body
./bing-wallpaper.go:475: non-declaration statement outside function body
./bing-wallpaper.go:484: non-declaration statement outside function body
./bing-wallpaper.go:486: non-declaration statement outside function body
./bing-wallpaper.go:487: syntax error: unexpected }
[xpi@localhost linux-bing-wallpaper]$ go version
go version go1.3.3 linux/amd64
[xpi@localhost linux-bing-wallpaper]$
I see that this is one of your projects: https://build.opensuse.org/package/show/home:MargueriteSu:unity/unity
Do you think you could try packaging unity 7.5.0? Or perhaps if it doesn't interest you, you could point me to how I can build it? Ty
Running the app from Konsole works beautifully:
upstream uri:http://bing.com/th?id=OHR.BeaversBend_EN-US8963318493_1920x1200.jpg
Downloaded /home/joe/Pictures/Bing/OHR.BeaversBend_EN-US8963318493_1920x1200.jpg
setting wallpaper for plasma5
Set wallpaper for plasma5
But running via cron failed initially, due to a missing xdotool:
goroutine 1 [running]:
main.setPlasmaWallpaper({0xc000252050, 0x4c}, {0x7bdedd, 0x4})
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:240 +0x878
main.setWallpaper({0x7bdedd, 0x4}, {0xc000252050, 0x4c}, {0x0, 0x0}, {0xc00001a3a8, 0x16})
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:220 +0x611
main.main.func1.1(0xc00005af60)
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:464 +0xda
main.main.func1(0xc0000a66e0)
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:469 +0x319
github.com/urfave/cli.HandleAction({0x757980, 0x7e1290}, 0xc0000ca380)
/home/joe/git/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:526 +0xa8
github.com/urfave/cli.(*App).Run(0xc0000ca380, {0xc000012210, 0x1, 0x1})
/home/joe/git/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:288 +0x734
main.main()
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:510 +0x63f
I didn't need xdotool to run interactively, but I assume that's something to do with $DISPLAY and/or .Xauthority from cron. After installing xdotool, cron runs incorrectly detect the desktop as kde4:
upstream uri:http://bing.com/th?id=OHR.BeaversBend_EN-US8963318493_1920x1200.jpg
Downloaded /home/joe/Pictures/Bing/OHR.BeaversBend_EN-US8963318493_1920x1200.jpg
setting wallpaper for kde4
panic: exit status 1
goroutine 1 [running]:
main.errChk(...)
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:46
main.setPlasmaWallpaper({0xc0001b4050, 0x45}, {0x7bdedd, 0x4})
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:259 +0x847
main.setWallpaper({0x7bdedd, 0x4}, {0xc0001b4050, 0x45}, {0x0, 0x0}, {0xc0000c2378, 0x16})
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:220 +0x611
main.main.func1.1(0xc0000b2f00)
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:464 +0xda
main.main.func1(0xc0000e4840)
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:469 +0x319
github.com/urfave/cli.HandleAction({0x757980, 0x7e1290}, 0xc00010c380)
/home/joe/git/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:526 +0xa8
github.com/urfave/cli.(*App).Run(0xc00010c380, {0xc0000981f0, 0x1, 0x1})
/home/joe/git/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:288 +0x734
main.main()
/home/joe/git/linux-bing-wallpaper/bing-wallpaper.go:510 +0x63f
Adding --desktop plasma5
to the crontab fixes this.
~/Sources/linux-bing-wallpaper/linux-bing-wallpaper
Started linux-bing-wallpaper
upstream uri:http://bing.com/th?id=OHR.IvishakRiver_EN-US1566710821_1920x1200.jpg
panic: fork/exec /usr/bin/file: no such file or directory
goroutine 1 [running]:
main.errChk(...)
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:46
main.imageChk(0xc0000a88a0, 0x52, 0x67cdb, 0x67cdb)
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:86 +0x2e7
main.downloadWallpaper(0xc00001e7d0, 0x46, 0xc000024300, 0x23, 0x0, 0x0)
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:137 +0x54d
main.main.func1.1(0xc000060f60)
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:461 +0x9c
main.main.func1(0xc00012c9a0, 0x0, 0x0)
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:469 +0x449
github.com/urfave/cli.HandleAction(0x7c8940, 0x8606e0, 0xc00012c9a0, 0xc00012c9a0, 0x0)
/home/alpine/Sources/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:526 +0x105
github.com/urfave/cli.(*App).Run(0xc00014a380, 0xc000012220, 0x1, 0x1, 0x0, 0x0)
/home/alpine/Sources/linux-bing-wallpaper/vendor/github.com/urfave/cli/app.go:288 +0x675
main.main()
/home/alpine/Sources/linux-bing-wallpaper/bing-wallpaper.go:510 +0x68c
When I run the script I get a zsh: = not found
error. The problem lies with the ==
checks in bing_wallpaper.sh#L26-L44 (see http://slopjong.de/2012/07/02/compatibility-between-zsh-and-bash/).
When setting the background with feh, the --bg-fill
option should be used instead of the --bg-tile
option, as the tile option does not display the background correctly with multiple monitors and resolutions.
https://github.com/marguerite/linux-bing-wallpaper/blob/master/bing-wallpaper.go#L338
The script says:
fabio@a514:~$ bingwallpaper
Pinging Bing API...
Bing Image of the day: http://www.bing.com/az/hprichbg/rb/DivingGondola_EN-US11480704756_1920x1200.jpg
Saving image to /home/fabio/Pictures/Bing/DivingGondola_EN-US11480704756_1920x1200.jpg
New wallpaper set successfully for LXDE.
but the wallpaper didn't get changed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.