[other] AppImage 启动器图标不对?DDE 25 修复步骤
Tofloor
poster avatar
winds
deepin
2026-10-22 16:51
Author

Deepin 25 手动装 AppImage 后启动器图标不对?一套可复制的修复步骤

环境:Deepin 25(DDE 25,bloom 主题,系统盘只读)
适用:把 AppImage / 绿色软件放到 ~/apps 后,启动器图标空白、显示通用图标,或改了图标一直不刷新。

一、先搞清楚 DDE 怎么找图标

DDE 的启动器按 .desktop 里的 Icon= 去找图标:

  • Icon= 写的是主题图标名(如 CrealityPrint),不是文件路径
  • 图标放在 ~/.local/share/icons/hicolor/<尺寸>/apps/<名字>.png
  • 用户级 hicolor 目录必须有 index.theme,否则 DDE/GTK 不会把它当成一个图标主题来扫描
  • dde-application-manager 会把渲染结果缓存到 ~/.cache/deepin/icons/*.png,改图标后不清缓存就会一直显示旧图

很多人卡在第三步和第四步:图标文件明明放了,但没 index.theme,或者缓存没清。

二、完整步骤

1. 放好 AppImage

mkdir -p ~/apps
mv CrealityPrint.AppImage ~/apps/
chmod +x ~/apps/CrealityPrint.AppImage

2. 拿到一张原图,生成多尺寸图标

如果 AppImage 里自带图标,可以先解包找:

cd /tmp
~/apps/CrealityPrint.AppImage --appimage-extract
find squashfs-root -maxdepth 4 -iname '*.png' -o -iname '*.svg' | head
# 常见位置:squashfs-root/.DirIcon、squashfs-root/usr/share/icons/...

拿到一张 512×512 或更大的 PNG 后,用 PIL 生成整套尺寸:

from PIL import Image

src = "icon.png"          # 换成你的原图
name = "CrealityPrint"    # 与 .desktop 的 Icon= 一致
sizes = (16, 24, 32, 48, 64, 96, 128, 192, 256, 512)

im = Image.open(src).convert("RGBA")
for s in sizes:
    out = f"/home/{__import__('getpass').getuser()}/.local/share/icons/hicolor/{s}x{s}/apps"
    import os; os.makedirs(out, exist_ok=True)
    im.resize((s, s), Image.LANCZOS).save(f"{out}/{name}.png")

没有 PIL 就 sudo apt install python3-pil,或者用 ImageMagick:
for s in 16 24 32 48 64 96 128 192 256 512; do convert icon.png -resize ${s}x${s} ...; done

3. 写 .desktop

~/.local/share/applications/crealityprint.desktop:

[Desktop Entry]
Type=Application
Name=Creality Print
Comment=3D 打印切片软件
Exec=/home/maf/apps/CrealityPrint.AppImage %U
Icon=CrealityPrint
Terminal=false
Categories=Graphics;3DGraphics;

注意:

  • Icon= 只写名字 CrealityPrint,不要写绝对路径
  • Exec= 用绝对路径;如果 AppImage 需要 FUSE,确保 libfuse2 已安装
  • 想让任务栏正确分组,可加 StartupWMClass=,值用运行后 xprop WM_CLASS 查到的类名

校验:

desktop-file-validate ~/.local/share/applications/crealityprint.desktop

4. 补用户级 hicolor/index.theme(关键)

~/.local/share/icons/hicolor/index.theme:

[Icon Theme]
Directory=16x16/apps,24x24/apps,32x32/apps,48x48/apps,64x64/apps,96x96/apps,128x128/apps,192x192/apps,256x256/apps,512x512/apps

[16x16/apps]
Contexts=Applications
Size=16
MinSize=16
MaxSize=16
Type=Directories

[24x24/apps]
Contexts=Applications
Size=24
MinSize=24
MaxSize=24
Type=Directories

[32x32/apps]
Contexts=Applications
Size=32
MinSize=32
MaxSize=32
Type=Directories

[48x48/apps]
Contexts=Applications
Size=48
MinSize=48
MaxSize=48
Type=Directories

[64x64/apps]
Contexts=Applications
Size=64
MinSize=64
MaxSize=64
Type=Directories

[96x96/apps]
Contexts=Applications
Size=96
MinSize=96
MaxSize=96
Type=Directories

[128x128/apps]
Contexts=Applications
Size=128
MinSize=128
MaxSize=128
Type=Directories

[192x192/apps]
Contexts=Applications
Size=192
MinSize=192
MaxSize=192
Type=Directories

[256x256/apps]
Contexts=Applications
Size=256
MinSize=256
MaxSize=256
Type=Directories

[512x512/apps]
Contexts=Applications
Size=512
MinSize=512
MaxSize=512
Type=Directories

5. 刷新图标缓存

gtk-update-icon-cache -f ~/.local/share/icons/hicolor

6. 清 DDE 的渲染缓存并重启 app-manager

rm -f ~/.cache/deepin/icons/*.png
pkill -f dde-application-manager     # 会被自动拉起

然后重新打开启动器(或注销重登一次)。

三、验证清单

# 1. desktop 文件合法
desktop-file-validate ~/.local/share/applications/crealityprint.desktop

# 2. 图标主题能被识别
ls ~/.local/share/icons/hicolor/index.theme
ls ~/.local/share/icons/hicolor/256x256/apps/CrealityPrint.png

# 3. 缓存已重建
ls -l ~/.cache/deepin/icons/ | head

# 4. 直接按 desktop 启动,确认 Exec 没问题
gtk-launch crealityprint

四、我踩过的坑

  1. 不要自建 ~/.local/share/icons/bloom/ 去覆盖当前主题。
    同名主题的 index.theme 不是"合并",而是遮蔽:整套 bloom 图标会被降级成只有你放进去的那几个,其他地方全变通用图标。已撤销。
  2. Icon= 写绝对路径不如主题名可靠。
    在 DDE 25 上,Icon=/home/maf/apps/icon.png 有时能显示、有时不能;改成主题名 + hicolor 后稳定。
  3. deepin 25 的 /usr/share 是只读的(快照根)。
    别往 /usr/share/applications、/usr/share/icons 里装东西,重启就没了;一律放 ~/.local/share。
  4. 改了图标但启动器不变,十有八九是缓存。
    ~/.cache/deepin/icons/*.png 里存的是按内容哈希命名的渲染结果,旧图会一直命中;清掉并重启 dde-application-manager 才生效。
  5. 换 .desktop 文件名 = 换应用 ID。
    改名后旧缓存仍占着旧 ID,可能出现"两个同样的图标";改名后同样清一次缓存。

这套流程在 Blender、FreeCAD 1.1.3、CrealityPrint 7.2.1 上都验证过,装完启动器图标正常。核心就三件事:主题名 + hicolor 带 index.theme + 清 DDE 缓存。

Reply Favorite View the author
All Replies
avatar
erdospj
deepin
2026-10-22 21:07
#1

👍

Reply View the author
avatar
云已
deepin
2026-10-22 21:16
#2

雷锋

Reply View the author
avatar
BigFish
deepin
2026-10-22 22:33
#3

直接用workbuddy写,还会考虑版本升级的问题
图片.png

Reply View the author