Can you add dock popup items to an Apple or enhanced applet?

I’m hoping that there is a way for an Applet (apple or enhanced) to display custom popup items when the user clicks and holds the app’s icon in the dock.

For example, if you click and hold on the Safari icon you get a popup where the user can select any open window, or New Window; New Private Window (in addition to the standard options).

I would like to be able to put an applet’s icon in the doc and give the user custom options that they can select when they click and hold on the doc icon. The applet would then execute a comman linked to that option.

Is this doable?

It is a very easy task for Cocoa AppleScript application made with Xcode.

But I’d never made Dock menu with AppleScript Apple genuine applet or SD’s enhanced applet.

NSApplication’s sharedApplication (it is ScriptDebugger itself when we run this code on SD) does not respond to “dockMenu()”.

Making NSMenu object and NSMenuItem is very easy.
Binding NSMenu to applet’s dockMenu seems a hard work.

1 Like

Apple’s online reference says NSApplicationDelegate’s applicationDockMenu: returns Dock menu.

Cocoa-AppleScript applet (you can select Script Editor’s file>Create from template menu) may can handle such a dock menu.

Then you can try to generate Dock menu by loading AppleScriptObjC.framework on Apple genuine AppleScript applet.