我在哪里可以获得与 gsettings 一起使用的 SCHEMA / PATH / KEY 列表?

Sri*_*Sri 23 compiz gconf gsettings dconf

经过一番研究,我发现我可以使用gsettings终端中的命令快速设置配置选项,而不是安装dconf-editororgconf-editor或 CCSM。

但是我们需要 SCHEMA/PATH 和 KEY 来设置值。
语法是:

gsettings set SCHEMA[:PATH] KEY VALUE
Run Code Online (Sandbox Code Playgroud)

例如,从不自动隐藏启动器:

gsettings set com.canonical.Unity2d.Launcher hide-mode 0
Run Code Online (Sandbox Code Playgroud)

并且,对于不与启动器重叠的窗口:

gsettings set com.canonical.Unity2d.Launcher use-strut true 
Run Code Online (Sandbox Code Playgroud)

那么,我在哪里可以获得可以使用 gsettings 设置的所有 SCHEMA / PATH / KEY 的列表?

不,请不要建议该gsettings list-keys命令,因为我不知道可能有数百个可用的模式。

Rin*_*ind 35

gsettings list-schemas为您提供所有架构。你也可以使用gsettings list-recursively你想要的东西,但这个程序将列出所有模式的所有键的所有值:(
让我们调用脚本gsettings-iterate-all

#!/bin/bash
# Gnome 3 can be customised from the command line via the gsettings command
# This script should help you to find what you're looking for by
# listing the ranges for all keys for each schema

for schema in $(gsettings list-schemas | sort)
do
    for key in $(gsettings list-keys $schema | sort)
    do
        value="$(gsettings range $schema $key | tr "\n" " ")"
        echo "$schema :: $key :: $value"
    done
done
Run Code Online (Sandbox Code Playgroud)

扩展您的示例gsettings-iterate-all | grep com.canonical.Unity2d.Launcher 收益

com.canonical.Unity2d.Launcher :: edge-decayrate :: type i 
com.canonical.Unity2d.Launcher :: edge-overcome-pressure :: type i 
com.canonical.Unity2d.Launcher :: edge-responsiveness :: type d 
com.canonical.Unity2d.Launcher :: edge-reveal-pressure :: type i 
com.canonical.Unity2d.Launcher :: edge-stop-velocity :: type i 
com.canonical.Unity2d.Launcher :: hide-mode :: type i 
com.canonical.Unity2d.Launcher :: only-one-launcher :: type b 
com.canonical.Unity2d.Launcher :: reveal-mode :: type i 
com.canonical.Unity2d.Launcher :: super-key-enable :: type b 
Run Code Online (Sandbox Code Playgroud)

您可以将输出重新路由到文件以便于阅读。

对于有创造力的人来说。以下是 gsettings 的可能选项列表,这些选项可能有助于创建其他脚本

  • Rinzwind,感谢您提供额外的有用信息。在我发布问题后,我意识到可以使用命令 gsettings list-recursively 获得完整的列表,但就像你说的,你为创意人士提供了很好的附加信息:) (2认同)
  • @Rinzwind 作为可能有用的实用说明:不要调用测试脚本“test”(我将其编辑掉)。启动“test”会很好地工作 - 并且完美地完成它的工作。但它可能是`/usr/bin/test`;为了使其速度非常快,它也是一个内置的 shell。- 没有参数的工作是返回退出代码“0”并保持安静。(参见“人测试”) (2认同)