現在、 Gjsで単純なアプリケーションを構築しています。これにより、gnome-shell の背景画像が変更されるはずです。gsettings
-toolを使用してこれを行う方法に関する解決策は、ここにあります。
その周りにデスクトップアプリケーションを構築したいので、Gio の -class を使用して -key を変更したいと考えていorg.gnome.desktop.background.picture-uri
ます。ただし、-メソッドを使用してもキーの値は変更されません。GSettings
set_X()
これは gsettings 値を変更する私のコードです:
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";
値の読み取りは期待どおりに機能し、is_writable()
-method が返さtrue
れ、set_string()
-method も返されますtrue
。
「delay-apply」モードではなく、キーにGVariantType
of 文字列があることを確認したので、set_string()
-method が機能するはずです。
通常のgsettings
コマンドライン ツール (リンクされた投稿で説明されている) を使用すると、問題なく動作します。
何が問題なのかわかりません。ログなどを探すことができる場所はありますか?