Custom Icon Manager

@noisneil, you've been creating/sharing incredible useful macros recently. Just can't thank you enough. You even added the keyboard navigation for the icon chooser window. And now a live search for the icons too. Superb!

4 Likes

Updated to include automatic grid scrolling when navigating with the arrow keys.

3 Likes

Updated to handle replace/rename when creating new custom icons, as suggested by @cdthomer.

1 Like

Updated with a new method to focus the Icon Well, so that the macro still works when in Smart Groups (e.g. All Macros).

In case you may find this is useful for other macros:

tell application "System Events"
	tell application process "Keyboard Maestro"
		set frontmost to true
		tell (first window whose subrole is "AXStandardWindow")
			tell group 6
				tell splitter group 1
					tell scroll area 3
						set focused of image 1 to true
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

This doesn’t work on my end, either in regular macro groups or smart groups. :thinking:

Interesting. Works flawlessly here.

Can you run this (select "Click") while hovering over an icon well? Do it while in a smart group and in a regular one and compare the output.

Using UI Browser I got the following syntax as you, and the AppleScript works when running manually (from Script Debugger), so it’s likely a timing issue on my end, because it would end up in the macro title field, and nothing was pasted into the image well. I’ll tinker with it today to see what might be going on.

Well I’m a dingbat... didn’t even notice the keystroke action after the AppleScript... removing that action fixes the issue.

Macro Screenshot (click to expand/collapse)

1 Like

No, I'm the dingbat. I noticed that, deleted it and then neglected to actually upload the update!!!! :man_facepalming:t2:

I'll upload again in a sec.

Edit: Done!

1 Like

Updated with the ability to create a new icon from within the Icon Chooser by pressing the new + button.

1 Like

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.

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