Skip to main content
Question

Custom icons for files or folders

  • September 20, 2017
  • 3 replies
  • 40 views

Forum|alt.badge.img+1

Hello, I am trying to install a program that resides in a folder with a custom folder. After installation the icon file looses its attributes and the icon itself does not display. That means, composer displays things fine, but after the installation the folder will lose the icon.

3 replies

Forum|alt.badge.img+18
  • Honored Contributor
  • September 20, 2017

I iconize a folder with the following script

#!/usr/bin/env python
import Cocoa
import sys

Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(Cocoa.NSImage.alloc().initWithContentsOfFile_(sys.argv[1].decode('utf-8')), sys.argv[2].decode('utf-8'), 0) or sys.exit("Unable to set file icon")

Gist

Executing by running:

python set-image.py "locationtopngyouwanttouse.png" fulllistingtofolder

eg

python set-image.py Office-2016-Office.png /Applications/Microsoft Office 2016/

AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • September 21, 2017

I had that happen to me once. Within Composer, make sure the permissions on the icon file are set to Read for all.


whitebeer
Forum|alt.badge.img+7
  • Contributor
  • April 21, 2020

I came along this question and tried out the idea of @AVmcclint. It also worked out for me! 👍
The problem was that I removed the icon-file from the created package in Composer.

I added the picture with copy-paste method in the Finder > Information window.
So just open the picture, copy and paste it on the Foldericon. After that I checked the privileges in Composer, the Icon file is not present for the users but works as folder icon 🙂