Gnome3桌面环境添加应用文件夹

Gnome3桌面环境添加应用文件夹

前几天安装完 Wine 以后,发现 Gnome 桌面的应用窗口已经不能看了,各种被 WIne 的图标霸占,而且特别杂,显得非常凌乱,我就想能不能自己创建一个 Wine 文件夹,然后把他们全放进去,但是 Gnome 好像不支持拖拽重叠生成文件夹,通过 WIKI,发现了 gsettings 命令方法:

以下是 Gnome For WIKI 原文:

It should return and empty square brackets list. If not, you may wish to add the content of this list to your new list in the following commands instead of replacing it.
To add the folders, proceed as follow:
gsettings set org.gnome.desktop.app-folders folder-children “[‘AppFolderName’]”
What if you want almost all applications in one or more categories except few of them? You can simply specify an exclusion list using the key excluded-apps. For example, suppose we want to exclude Acrobat Reader from the Office folder:
gsettings set ‘org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/AppFolderName/‘ apps “[‘gnome-maps.desktop’]”

他是首先通过gsettings指令向org.gnome.desktop.app-folders这个 XML 标记文件读取一下结构,(有兴趣研究一下这个 XML 的同学请跳转到:**/usr/share/glib-2.0/schemas/org.gnome.desktop.app-folders.xml)**,然后再写入到 Gnome-dconf”类 WIndows 注册表中”,然后通过 gsettings ………apps 这个命令向文件夹中添加程序。

但是我发现这种方法好像并不是很灵活,像删除、重命名、文件夹图标等等都没有说明,于是还是我自己研究一下把。

我的方法

是首先通过打开dconf-editor,搜索 WIKI 中所说的那个 xml 文件org.gnome.desktop.app-folders
结果如下:

是不是很眼熟,Utilities 也就是 Gnome 默认的杂项文件夹,而 Sundry 就是工具文件夹,有了这个思路,是不是往Folder-children里面添加 项 就能创建文件了,答案是:不是,无论怎么添加。

在下面的 folder 节点中都不会出现你创建的 文件夹 项名,已经对应的项 名称 和 值。

再次 google-WIKI,发现了另一种方法:

1。通过 Gnome 自带的软件商店,点击已安装,然后点击右上角的勾号,选中一个软件后,点击左下角的添加到目录以后,点击 “+”号后,就能创建一个文件夹,而且会出现在 dconf 的 folder 节点下,根据其余两个自带文件夹的创建规则,我们需要打开 terminal。

2。然后转到 /usr/share/desktop-directories 这个目录下,创建一个 xxxx.directory 文件,然后写入如下:

[Desktop Entry] > Name=Zwin #主名称
Name[zh_CN]=组件 1 #简体中文的名称
Icon=applications-other #应用文件夹图标,可以是绝对路径的图标,
applications-other #就会像自带的那样显示文 件夹中应用的缩略图。
Type=Directory #类型 Directory 项文件

3.创建完成以后,我们打开 dconf-editor,跳转到 org/gnome/desktop/app-folders/folders
然后打开用 gnome 应用商店中创建的那个项。
参数解释如下:

apps
需要放入这个文件夹的应用名称,详细参考:/usr/share/applications 目录中所有应用的 desktop 文件名称,格式 [‘xxxxxx0.desktop’, ‘xxxxxxx1.desktop’,’xxxxxxx2.desktop’]

categories
这个类别名称,填写第二步中创建的 directory 文件的名称即可,不需要带后缀名

excluded-apps
默认[]即可

name
填写 directory 文件的全名,带后缀名。

translate
转化,勾选。

这样就创建完成了,以后需要添加或者删减文件夹中的应用,用 dconf 修改 apps 项即可,如果需要改变应用文件夹的图标,名称,修改 /usr/share/desktop-directories/directory文件即可,不想要这个应用文件夹了,在 dconf 中删除 apps 项中的所有,然后删除 directory 文件即可。

评论