marguerite / linux-bing-wallpaper

set Bing Wallpaper of the Day as your Linux Desktop's wallpaper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cron run detects wrong desktop

mrfuton opened this issue · comments

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.