• GSettings/gsettings/dconf/dconf-editor介绍及使用


    本文主要介绍gnome相关工具使用。环境是SUSE Linux Enterprise 15 SP4, gnome版本号: Gnome Shell 41.4
    参考文档: https://wiki.gnome.org/HowDoI/GSettings
    https://segmentfault.com/a/1190000019968756
    https://help.gnome.org/admin/system-admin-guide/stable/index.html.en

    1. GSettings

    GSettings is a high-level API for application settings, front end for dconf.
    配置文件:
    GSettings 的配置文件是 xml 格式的,文件需以 .gschema.xml 结尾,文件名通常与 id 相同。配置文件安装在 /usr/share/glib-2.0/schemas/ 目录下,手动添加进去的文件需要执行 sudo glib-complie-schemas /usr/share/glib-2.0/schemas 让其生效。

    2. gsettings command

    The gsettings command-line tool is used to view and change user settings.
    通俗来讲,dconf/user是GNOME的注册表,gsettings是一个查询、读取、设置注册表键值的命令行工具。gnome 桌面环境的外观配置数据是使用 gsettings 来存储,所以可以通过 gsettings 来设置和读取。gsettings 相比设置界面(如dconf-editor)就是可以设置到更多的选项,设置的值更加精确。
    gsettings命令的参数如下,比较常用的是 gsettings list-recursively | grep xx 用于查找包含关键字xx的key和value。gsettings set/get 用于设置、读取指定key的值。:
    在这里插入图片描述

    例如,查找和home相关的键值:在这里插入图片描述
    获取桌面图标主题,字体名称:
    在这里插入图片描述

    3. dconf 文件 (namely, ~/.config/config/user)

    dconf is a key-based configuration system which manages user settings. It is the back end for GSettings used in Red Hat Enterprise Linux 7. dconf manages a range of different settings, including GDM, application, and proxy settings.
    dconf 使用 gvdb(GVariant Database file) 格式的二进制文件存储数据,它是一个简单的数据库,以路径映射的方式存储 key ,检索高效。默认的文件路径为: ~/.config/dconf/user
    dconf/user文件存储着GNOME的配置,包括通过gsettings对当前用户的设置,以及gnome extension的设置等, 是个二进制文件,不能打开查看。

    4. dconf command

    The dconf command-line utility is used for reading and writing individual values or entire directories from and to a dconf database.
    比如,读取桌面背景图:可以使用dconf read 命令,设置桌面背景图,可以使用dconf set命令。
    在这里插入图片描述

    5. dconf-editor

    gconf-editor is the graphic editor for dconf key-based configuration system.
    如果系统中没有gconf-editor tool,需要通过yast安装。安装完成之后用命令打开,gconf-editor是以目录的形式展示。
    在这里插入图片描述

    6. how to read the ~/.config/dconf/user file

    cd
    cp ~/.config/dconf/user ~/.config/dconf/test
    printf %s\n “user-db:test” > db_profile
    DCONF_PROFILE=~/db_profile dconf dump / > old_settings

  • 相关阅读:
    【C++语法讲解】 | 运算符重构 | 三种运算符的重构方式 |代码演示
    MACOS arco design 初学者踩坑指南
    【Docker】二、docker镜像的制作运行发布
    PHP 语法...的用法
    STL——vector
    Vue-dvadmin-d2-crud-plus-常用配置-row-handle-columns-options
    盘点那些开发中经常用到的git命令
    [Java反序列化]—CommonsCollections1
    day26stream流和方法引用
    SpringBoot使用Pio-tl动态填写合同(文档)
  • 原文地址:https://blog.csdn.net/tongyi04/article/details/127672241