Sunday, May 5, 2024
110
rated 0 times [  110] [ 0]  / answers: 1 / hits: 130644  / 2 Years ago, tue, november 15, 2022, 2:56:54

I have a script that updates my desktop background every day with the NASA APOD. Since upgrading to 11.10, that script stopped working, presumably because I'm using gconftool-2 to actually update the desktop background. Is there a new way to do this under Unity?


More From » command-line

 Answers
3

Gnome Shell (Gnome 3) uses GSettings now instead of GConf. So in Gnome Shell you can use the command-line tool gsettings for that. Like gconftool, it lets you get or set an individual key.


You can get the current URI of the background image as follows:


gsettings get org.gnome.desktop.background picture-uri
'file:///home/serrano/Pictures/x.jpg'

And set the background URI as follows (which will immediately update your desktop background):


gsettings set org.gnome.desktop.background picture-uri file:///home/serrano/Pictures/y.jpg

Notice that you must prepend the URI with "file://" for this to work (unlike with gconftool).


Ubuntu 22.04 and later


Since Ubuntu 22.04 the behavior has changed a little, depending on your color scheme preference:


gsettings get org.gnome.desktop.interface color-scheme

If your color-scheme is "prefer-dark" use picture-uri-dark instead:


gsettings set org.gnome.desktop.background picture-uri-dark file:///home/serrano/Pictures/y.jpg

Otherwise use picture-uri like before:


gsettings set org.gnome.desktop.background picture-uri file:///home/serrano/Pictures/y.jpg

[#42976] Wednesday, November 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trousransla

Total Points: 285
Total Questions: 112
Total Answers: 113

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;