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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值