[deepin exploration] [求助]如何在自定义主题中使用dci图标?
Tofloor
poster avatar
MeGusta
deepin
2025-09-08 09:21
Author

在deepin25的8月27日更新之后,自定义主题失效了。

简单研究了一下,可以通过在 $HOME/.local/share/deepin-themes路径下,照抄系统主题,来创建自定义的主题,可以恢复部分的文件图标,但是大部分文件图标依然是默认的 nirvana主题。

image.png

偶然看到了这个工具:https://github.com/linuxdeepin/deepin-desktop-theme/tree/master/tools/xdgicon2dci

顾名思义是,将xdg标准的图标转换为dci格式的工具。

通过查看代码,和借助chatgpt,将cpp代码转换成了python脚本,并作了一些修改,让它可以批量转换用户目录中的图标主题:xdgicon2dci_python.zip

转换之后,文件数量就只有数百个,跟之前xdg规范的数千个文件相比,就简洁多了。

但是我应该如何使用这些dci,来重新创建我的自定义图标主题呢?

image.png

Reply Favorite View the author
All Replies
deepin-流云
Moderator
Community OP
2025-09-08 09:44
#1

这个改动会在近期的更新中修复调整,暂时先忍耐一段时间吧…

Reply View the author
zccrs
deepin
2025-09-08 09:45
#2

你把这些文件放到 “/usr/share/dsg/icons/你的主题名” 这个目录下就行,目录是需要创建的,在 “~/.local/share/dsg/icons/你的主题名” 也行

Reply View the author
zccrs
deepin
2025-09-08 09:47
#3

8月27日的那个更新会回退掉,或者你也手动删除 /usr/share/dsg/icons/*.dci
/usr/share/dsg/icons/**.dci 是不在任何主题里的图标,这些图标会被当作dci最终的fallback使用,所以出现了现在的问题,删掉它们就可以解决。

Reply View the author
MeGusta
deepin
2025-09-08 10:15
#4
zccrs

你把这些文件放到 “/usr/share/dsg/icons/你的主题名” 这个目录下就行,目录是需要创建的,在 “~/.local/share/dsg/icons/你的主题名” 也行

还需不需要写index.theme?路径放到哪里去?或者说,现在dsg规范的图标主题,文件目录结构应该是怎样的,有没有指南?

我是不大想操作系统目录,只想在用户目录里面。

Reply View the author
MeGusta
deepin
2025-09-08 10:17
#5
deepin-流云

这个改动会在近期的更新中修复调整,暂时先忍耐一段时间吧…

还好,随机应变,已经习惯了🤧

Reply View the author
zccrs
deepin
2025-09-08 10:39
#6
MeGusta

还需不需要写index.theme?路径放到哪里去?或者说,现在dsg规范的图标主题,文件目录结构应该是怎样的,有没有指南?

我是不大想操作系统目录,只想在用户目录里面。

不需要写 Index.theme,dci的主题很简单,所以没有专门写规范,只有一个目录规范。

https://desktopspec.org/unstable/%E7%B3%BB%E7%BB%9F%E7%9B%AE%E5%BD%95%E8%A7%84%E8%8C%83.html

所有dci的图标都只需要放在 "$DSG_DATA_DIR/icons/主题名/*.dci"
其中目录名就是这个主题的名字,主题里不分子目录,所有dci文件都放一起就行,也不用写 Index.theme 这种描述文件来说明每个dci的用途。

Reply View the author
zccrs
deepin
2025-09-08 10:41
#7
zccrs

不需要写 Index.theme,dci的主题很简单,所以没有专门写规范,只有一个目录规范。

https://desktopspec.org/unstable/%E7%B3%BB%E7%BB%9F%E7%9B%AE%E5%BD%95%E8%A7%84%E8%8C%83.html

所有dci的图标都只需要放在 "$DSG_DATA_DIR/icons/主题名/*.dci"
其中目录名就是这个主题的名字,主题里不分子目录,所有dci文件都放一起就行,也不用写 Index.theme 这种描述文件来说明每个dci的用途。

做到这一步就能被dtk的程序使用,不过要在控制中心里显示,可能还需要写一个 /usr/share/deepin-themes/bloom/index.theme 这样的内容,这一点我不确定,你可以试试。

Reply View the author
zccrs
deepin
2025-09-08 10:52
#8
MeGusta

还需不需要写index.theme?路径放到哪里去?或者说,现在dsg规范的图标主题,文件目录结构应该是怎样的,有没有指南?

我是不大想操作系统目录,只想在用户目录里面。

看了下代码没有家目录,没有设置环境变量的话就是 /usr/share/dsg/icons 目录了

Reply View the author
zccrs
deepin
2025-09-08 10:54
#9
// If the icon name syntax is "AAA/BBB", then the "AAA" is the icon group name, the "BBB" is the actual icon
    // name. eg: "org.deepin.app/accounts", hypothesis the icon search path is "/usr/share/dsg/icons" and
    // icon theme name is "theme_name", then the icon files list for find is:
    // "/usr/share/dsg/icons/theme_name/org.deepin.app/accounts.dci"
    // "qrc:/dsg/icons/theme_name/org.deepin.app/accounts.dci" // fallback to the qrc directory
 
    // "/usr/share/dsg/icons/theme_name/accounts.dci" // ignore the icon group name
    // "qrc:/dsg/icons/theme_name/accounts.dci" // ignore the icon group name
 
    // "/usr/share/dsg/icons/accounts.dci" // ignore the icon theme
    // "qrc:/dsg/icons/accounts.dci" // ignore the icon theme
 
    // "qrc:/dsg/built-in-icons/accounts.dci" // fallback to built-in icons

这段是查找dci图标时的路径顺序。
Reply View the author
mhduiy
deepin
2025-09-08 11:19
#10

只需要放在 /usr/share/dsg/icons/<同xdg主题名的主题名>/ ,然后在控制中心选择这个图标主题就可以生效了,xdg图标不生效的问题会在 deepin-desktop-theme >= 1.1.14 修复

Reply View the author
MeGusta
deepin
2025-09-08 12:15
#11
mhduiy

只需要放在 /usr/share/dsg/icons/<同xdg主题名的主题名>/ ,然后在控制中心选择这个图标主题就可以生效了,xdg图标不生效的问题会在 deepin-desktop-theme >= 1.1.14 修复

我把1.1.14编译安装了,就好了,谢谢指导!

编译产物在此:

deepin-desktop-theme_1.1.14_amd64_10debs.zip

Reply View the author
MeGusta
deepin
2025-09-08 12:18
#12
zccrs
// If the icon name syntax is "AAA/BBB", then the "AAA" is the icon group name, the "BBB" is the actual icon
    // name. eg: "org.deepin.app/accounts", hypothesis the icon search path is "/usr/share/dsg/icons" and
    // icon theme name is "theme_name", then the icon files list for find is:
    // "/usr/share/dsg/icons/theme_name/org.deepin.app/accounts.dci"
    // "qrc:/dsg/icons/theme_name/org.deepin.app/accounts.dci" // fallback to the qrc directory
 
    // "/usr/share/dsg/icons/theme_name/accounts.dci" // ignore the icon group name
    // "qrc:/dsg/icons/theme_name/accounts.dci" // ignore the icon group name
 
    // "/usr/share/dsg/icons/accounts.dci" // ignore the icon theme
    // "qrc:/dsg/icons/accounts.dci" // ignore the icon theme
 
    // "qrc:/dsg/built-in-icons/accounts.dci" // fallback to built-in icons

这段是查找dci图标时的路径顺序。

谢谢指导,我觉得可否考虑,把用户配置目录加进去,磐石我是真不想动它。

Reply View the author