12.2. 自定义默认喜欢的应用程序
喜欢的应用程序是那些在
活动概览
中的 GNOME Shell dash 上看到的应用程序。您可以使用 dconf
为单个用户设置喜欢的应用程序,或者为所有用户设置相同的喜欢的应用程序。
12.2.1. 为单个用户设置不同的喜欢的应用程序 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您可以通过修改
~/.config/dconf/user
中的用户数据库文件,为单个用户设置默认喜欢的应用程序。以下示例使用 dconf
将 gedit、Terminal 和 Nautilus 设置为用户的默认喜欢。示例代码允许用户稍后修改列表(如果他们想要这样做的话)。
例 12.3. /etc/dconf/profile
的内容:
This line allows the user to change the default favorites later
# This line allows the user to change the default favorites later
user-db:user
例 12.4. ~/.config/dconf/user
的内容:
Set gedit, terminal and nautilus as default favorites
# Set gedit, terminal and nautilus as default favorites
[org/gnome/shell]
favorite-apps = ['gedit.desktop', 'gnome-terminal.desktop', 'nautilus.desktop']
注意
您也可以锁定上述设置以防止用户更改它们。如需更多信息,请参阅 第 9.5.1 节 “锁定特定设置”。
12.2.2. 为所有用户设置同样的喜欢的应用程序 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
要为所有用户具有相同的喜欢,您必须使用
dconf
keyfiles 修改系统数据库文件。以下示例编辑 dconf
配置文件,然后创建一个 keyfile 来为机构的第一个 floor 中的所有员工设置默认喜欢的应用程序。
例 12.5. /etc/dconf/profile
的内容:
user-db:user # This line defines a system database called first_floor system-db:first_floor
user-db:user
# This line defines a system database called first_floor
system-db:first_floor
注意
用户数据库文件
的设置将优先于 first_floor
数据库文件中的设置,但 first_floor
数据库文件中引入的锁定将优先于 用户
中存在的设置。有关锁的详情,请参考 第 9.5.1 节 “锁定特定设置”。
例 12.6. /etc/dconf/db/first_floor.d/00_floor1_settings
的内容:
This sample sets gedit, terminal and nautilus as default favorites for all users in the first floor
# This sample sets gedit, terminal and nautilus as default favorites
# for all users in the first floor
[org/gnome/shell]
favorite-apps = ['gedit.desktop', 'gnome-terminal.desktop', 'nautilus.desktop']
运行 dconf update 命令将您的更改合并到系统数据库中。
在系统范围的设置生效前,用户必须退出并重新登录。