Electron macOS: Change icon of files

Mattia Astorino

we're trying to find and use an electron API that let us change the icon of a file (macOS only).

Our app accept a folder from the macOS finder and we want a way/api to get the current folder icon and change it by passing a new icns or png file. Is it possible?

lifeisfoo

You should use the NSWorkspace.setIcon function but there is no way to use this API from electron.

Looks like electron doesn't support the direct access to this API and some related issues exists.

As a workaround you can create (compile) a macos binary that only do this and then exec it from electron code using child_process.execFile.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Electron tray icon change depending on dark theme?

How to add an icon to the right hand side of the MacOS menu bar in Electron?

How to add custom menu icon in menubar on macOS with electron?

Change the icon for php files in directory

How to change window icon in electron after browser is open?

How I can change the Electron app icon without electron-packager?

Customize Toolbar in Electron for MacOS

ElectronJS: How can I change the Electron homepage option when right-clicking the app's icon on the taskbar?

Electron Icon not building out with electron-packager

Windows - how to change desktop pdf files icon to same as in explorer?

Change the default location of zsh completion cache files for macOS

Problem installing electron on Linux/macOS

In WIndows, how to change the default icon for all *files* that don't have a specific icon?

Saving files locally with electron

Electron builder and asset files

opening pdf files in electron

Download files(Electron)

Change Windows Size in Electron

Reset custom macOS icon in rEFInd

Electron - How to change the default .icns that Electron adds

Can't Add Icon To Electron App With Electron Builder

electron tray icon issue on windows 10

Electron: Add app icon to bottom right of the taskbar

Make electron app icon bounce on start up

Electron app file association - Custom icon not appearing

Electron showOpenDialog not respecting extensions filter on macOS

Exported Electron APP doesn't work on MacOS

Electron overriding High DPI support on macOS with SDL

Files: One icon is large