私は現在Gjsに簡単なアプリケーションを構築しています。これは私のgnome-shellの背景イメージを変更するはずです。 gsettings
-toolを使用してこれを行う方法の解決策はhereです。GSettingsでdconf-entryを変更できません
私はデスクトップアプリケーションを構築したいので、GioのGSettings
-classを使用してorg.gnome.desktop.background.picture-uri
-keyを変更したいと思います。しかし、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";
はtrue
を返し、set_string()
-methodもtrue
を返し-method期待通りの仕事、is_writable()
を行います。
私は「遅延適用」モードではないことを確認しました。キーにはGVariantType
の文字列があるので、set_string()
のメソッドが機能するはずです。
通常のgsettings
コマンドラインツールを使用すると(リンク先で説明したように)うまく動作します。
私は問題が何であるか把握できません。ログなどを探すことができる場所はありますか?
私は昨日からこの問題を克服してきましたが、最終的に解決策を見つけられたことをうれしく思います。ありがとう! – Serrano