I'm currently building a simple application on Gjs, which should change the background-image of my gnome-shell. A solution on how this can be done using the gsettings
-tool can be found here.
Since I want to build a desktop-application around it, I want to change the org.gnome.desktop.background.picture-uri
-key by using Gio's GSettings
-class. But using the set_X()
-method does not change the value of the key.
This is my code to change the gsettings value:
var gio = imports.gi.Gio;
// Get the GSettings-object for the background-schema:
var background = new gio.Settings({schema: "org.gnome.desktop.background"});
// Read the current Background-Image:
print( "Current Background-Image: "+background.get_string("picture-uri") );
if (background.is_writable("picture-uri")){
// Set a new Background-Image (should show up immediately):
if (background.set_string("picture-uri", "file:///path/to/some/pic.jpg")){
print("Success!");
}
else throw "Couldn't set the key!";
} else throw "The key is not writable";
Reading the value does work as expected, the is_writable()
-method returns true
and the set_string()
-method also returns true
.
I have checked that I'm not in "delay-apply" mode and the key has a GVariantType
of string, so the set_string()
-method should work.
Using the normal gsettings
command-line tool (as explained in the linked post) works just fine.
I can't figure out what the problem is, is there any place I can look for logs or something?