Custom Icon Manager

Updated to allow for subdirectories in the Icon Folder and to automatically resize manually added large icons to 64x64px whenever the New Custom Icon function is executed.

1 Like

Thank you for the macro. I’d love to run in on my application folder and registering all app icons automatically. Is this possible?

1 Like

Very useful suggestion! I've added an extra tool at the bottom of the original post for this purpose. I don't think it needs to be part of the main macro, as you're unlikely to need to run it very often. Once might be enough. :+1:t3:

4 Likes

Great utility, thank you!
Is there a way to use this utility to change icons of the KM folder?

Disregard - it actually working fine for this purpose too.

1 Like

Update: After creating a new custom icon, you will be prompted with two options:

  • Reveal - reveals the new icon file in the Finder.
  • Use - pastes the new icon file in the current macro's icon well.

This means not having to create a new icon and then run the macro again to use it. It's now all in one run.

1 Like

Started using this yesterday, I like. I've always hoped the Keyboard Maestro icon browser would be searchable.

The icons weren't displaying for me in the browser, but the problem might have been that my icon folder was on an external drive.

Will this make my preferences file a little larger, compared to just selecting the app icon through the Keyboard Maestro icon browser?

Yes, I think that's a thing.

Yes, using custom icons rather than the stock KM ones will result a larger Keyboard Maestro preference file. Having said that, I use custom icons for all my macros and I haven't seen any reduction in performance.

I do try to reference files for found image actions though, as there may be numerous of those in a single macro and they are not resized to 64x64px.

I tried using the utility to pull out all my apps icons and that works fine. So now I have a folder containing over 600 icons...

The issue now is that when the icons are displayed they appear in some weird order whereas I prefer them sorted alphabetically. Maybe you left the list unsorted for a reason - I don't know, but I've just changed your shell script action "Get Icon Paths as List" very slightly to perform the sort like this:

image

Here's the script:

#!/bin/bash

# Get the value of the Keyboard Maestro variable
Local__IconFolder="$KMVAR_Local__IconFolder"

# Search for .png files recursively and print their paths
find "$Local__IconFolder" -type f -name "*.png" | sort

Feel free to incorporate or not :thinking:

2 Likes

Good call. It didn't seem important at the time, but I see no reason not to incorporate it now. Updated above. :+1:t3:

I've also updated the App Icon Grabber to only grab icons that don't already exist with the same name. This avoids overwriting all app icons every time the tool is run, and means it's quite a bit quicker to complete. The minor drawback is that if an updated app has a new icon, it will be ignored. Not that hard to manually add it via the main macro's App Icon option in the New Custom Icon prompt.

4 Likes

Awesome tool, Neil! :raised_hands:
This will definitely help with the workflow as KM's icon window can be a real pain, because of how slow it is and how hard it is to add custom icons. I was only able to add them by creating multiple .app files in the Applications folder and then adding the .icns file inside the Package Contents on each file. And this is the only way to have high quality icons when you use the Macro Switcher (if that's how it's called?). Everything that's pasted, is all blurry.

Recently I was able to create a macro that converts SVG or Bitmap images to .icns and I was able to automate the whole process of creating the .app file and all that, but your macro is way faster to then search and add the icons to the macro, and between fast+blurry versus super slow and painful+high quality, I rather go with fast+blurry :wink:

1 Like

The macro resizes the images for the use as macro icons. You could always remove that step so that they save full size to avoid blurriness.

I tried it before with bigger images and it always showed me blurry when using that prompt that shows all macros. The only way to use it was with the approach I shared, using the .icns file inside the .app file.
Maybe I can try it again, but I tested it a few times with high images and it seems that the issue is with the source itself, not so much the size of the image.


Here's something I created if you want to include it in your bundle?
I have several macros that already have icons and I want to reuse them so I can just copy the icon from the macro itself and it will then paste it in the custom icons folder.
Feel free to add it or not, change the text, variable names, etc. I just think it can be useful to others as it will be for me. I just forgot to add a "success" notification at the end, so if you want to use it, maybe you can add that.

I did it the way I am able to do it, but I'm sure there's some way to use a shell script or something to find the duplicates, so yeah, feel free to adapt that as well.

Icon Manager - Convert Clipboard to Custom Icon.kmmacros (48 KB)

Tested it again and yes, the size doesn't matter, as I suspected. Here's a macro with the icon coming from KM's icon chooser:
SCR-20240630-nwci

and here's another macro with a 1024px by 1024px png file, converted from an SVG image:
SCR-20240630-nwlq

Maybe I've misunderstood, but I think you've duplicated the existing function of my macro. If you press ⌃⌄⌘I, a prompt will appear for creating a new custom icon, and the top option is the current clipboard.

1 Like

I guess I skipped that part of your post.
Nice that this is included by default :slight_smile:
Thanks for clarifying

1 Like

Before I start diving deep into the macro to later realize that it's already implemented, can you clarify that when I pick an icon it automatically adds it to the macro and that's the only way to use it?

I use icons in Finder folders a lot and it really bothers me that I always have to navigate to a folder with icons I have every time I need to do that, not to mention that I need to find the icon, even if named properly.

I would love if I could use your macro to use it both with KM or Finder, or anything else, really. I think it's a great manager for any app where that is possible.

And for this to happen, the icon would have to be on the clipboard.
I am thinking that this could be achieved with one of the following:
1 - We could have a variable at the beginning of the macro that's set to either "true" or "false" and then based on that, it will always be used to add the icon to the macro, for those that only want to use the macro with KM, or it will always copy the image to the clipboard, and it would show a notification when it's copied (this could also be an option to turn on or off, for those that don't want a notification). So it's like a toggle in a settings page, so to speak.
2 - A modifier we could click and hold when we click an icon, maybe OPTION/ALT, and that would copy it to the clipboard. Without the modifier it would add it as a macro icon. I think this could also be set by the user:
a) what modifier to use
b) if holding the modifier will copy to the clipboard, or if it will be used in a macro. Since I will be using this for both KM and Finder, I would make it the clipboard be the default and the modifier would be to add to the macro.

Let me know what you think

Currently, yes, but it's not hard to make it work with Finder. Luckily enough, KM has a Set File Icon action, so we don't need to bother with the clipboard. Put this in your Finder group:

Icon Manager - Finder Version.kmmacros (102 KB)

Macro screenshot

Select one or more files in the Finder and trigger the macro with ⌄⌘I, then choose an icon to set icons for the current selection.

1 Like

You're the man!
Not only can I now pick an icon, but I don't have to Get Info and do it manually!
I would definitely vote for you for president! :joy:

1 Like

Glad you'll get some use out of it! :v:t3:

1 Like