从命令行配置 gnome-shell 扩展

alb*_*azo 12 gsettings gnome-shell-extension gnome-shell

我喜欢运行几个脚本来自动安装软件包并在新的操作系统安装上做一些配置。我使用带有一些扩展的 gnome shell,并且正在考虑改进我的脚本来配置它们。

我通常使用 gnome-shell-extension-prefs 或 dconf-editor 配置扩展,我知道如何从命令行编辑其他模式。例子:

gsettings set org.gnome.desktop.background picture-options stretched
Run Code Online (Sandbox Code Playgroud)

但是,虽然我可以使用 dconf-editor 在 org.gnome.shell.extensions 下找到并编辑已安装的扩展,但我无法使用 gsettings 访问它们,因为它们似乎没有分配的架构:

No such schema 'org.gnome.shell.extensions.extname'
Run Code Online (Sandbox Code Playgroud)

可通过 gsettings 访问的唯一扩展似乎是预装的扩展。

所以,问题是,如何从命令行配置已安装的扩展?有什么方法可以将编译的模式分配给 gsettings~/.local/share/gnome-shell/extensions/吗?也许我看错了方向。

环境:Ubuntu Gnome 14.04(Gnome Shell 3.10.4)

提前致谢。

alb*_*azo 12

最后自己找到了答案。

sudo cp ~/.local/share/gnome-shell/extensions/extname/schemas/org.gnome.shell.extensions.extname.gschema.xml \
    /usr/share/glib-2.0/schemas/ &&
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
Run Code Online (Sandbox Code Playgroud)

复制并编译架构~/.local/share/gnome-shell/extensions,gsettings 将能够使用它们。


小智 6

在 CentOS 7 中——我也认为在 Ubuntu 中——我通过引入 --schemadir 开关确定了我认为对已接受答案的轻微改进,如下所示:

# gsettings --schemadir ${schemaDir} set ${schema} ${key} "${value}"
Run Code Online (Sandbox Code Playgroud)

在上面的命令中 gsettings 直接设置${key}${value}in ${schema}where${schema}不在默认/usr/share/glib-2.0/schemas目录中。(并且不需要将架构移动到默认目录)

一些例子:

gsettings --schemadir ~/.local/share/gnome-shell/extensions/putWindow@clemens.lab21.org/schemas/ list-recursively org.gnome.shell.extensions.org-lab21-putwindow
gsettings --schemadir ~/.local/share/gnome-shell/extensions/unitylike-hotkey@webgyerek.net/schemas/  list-recursively org.gnome.shell.extensions.app-keys
gsettings --schemadir ~/.local/share/gnome-shell/extensions/emoji-selector@maestroschan.fr/schemas/  list-recursively org.gnome.shell.extensions.emoji-selector
Run Code Online (Sandbox Code Playgroud)