Programmatically set custom folder/directory icon in Linux

两盒软妹~` 提交于 2019-12-05 10:11:44

If you are using the KDE desktop, then simply create a .directory file inside the directory.

E.g. I have a custom icon for my directory named "dev.sparc". I created this using the KDE desktop. All it does is create a file which I can view.

$ cat dev.sparc/.directory
[Desktop Entry]
Icon=applications-engineering

Et voila. That's all there is to it. If you or your users are using Gnome, this will be similar but probably subtly different. Just create an empty directory, use Gnome to set an icon, then $ ls -al in the directory to see what file it created.

I was recently trying to do something similar with creating desktop shortcuts on various Linux platforms and found this post.

For more information, see the Desktop Entry Specification from freedesktop.org which describes the standard for desktop and directory shortcuts on KDE and GNOME desktops.

There is no standard way to do this across GNOME, KDE, and CDE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!