How to set a Keyboard Shortcut for a Photoshop UXP plugin?

Hello!
Is it possible to set a keyboard shortcut in a Photoshop plugin? I’ve seen some threads about it and some documentation mentioning UXP keyboard shortcuts for Adobe XD and thought it might work the same in manifest.json, but it doesn’t.

    {
      "type": "command",
      "id": "my_function",
      "label": {
        "default": "My Function"
      },
      "shortcut": {
        "mac": "Cmd+Shift+P",
        "win": "Ctrl+Shift+P"
      }
    }

Thank you!

Not yet possible. At least if you consider only the sane ways :smiley:

Thank you for your reply.

Any updates on this, in the past for traditional extendscript, I added shortcuts via the shortcut menu, so they aren’t hardcoded into the script .

However with the UXP plugins it would seem that keyboard shortcut menu only goes to the top level of the plugin menu…not down into the commands level (see screenshot attached)

1 Like

Yes, I’m very much hoping this gets implemented soon. Or that the developers have it on their timeline:

Any idea when this will be available? With CEP I was able to assign a hotkey to an action that fired an extendscript event. Is there any similar method we could use with UXP?

function sendEvent(type) {
    new ExternalObject('lib:\PlugPlugExternalObject');
    var event = new CSXSEvent();
    event.type = type;
    event.dispatch();
}

sendEvent('hotkey-process');
1 Like

still nothing? :frowning: This is such a basic thing to have!

1 Like

I confirmed with @indranil that the core UXP APIs don’t support keyboard shortcuts.

I know this is exceeding difficult from an engineering standpoint, yet highly requested by developers, so I’m going to open a poll and leave it here:

  • I would like the ability to set keyboard shortcuts in my script, panel, plugin, extension, or integration.
0 voters

And also let us know which for apps:

I would like the ability to set keyboard shortcuts for the following apps:
  • Photoshop
  • InDesign
  • Illustrator
  • Adobe Express
  • Adobe XD
  • Premiere Pro
  • After Effects
  • Bridge
  • UXP Developer Tool
  • Something else
0 voters

It would be nice if keyboard shortcuts could automatically be applied to UXP plugins. Basically, open the keyboard shortcuts menu and there would be a new checkbox for capturing a UXP button click as a shortcut if the checkbox was checked. Once it’s checked, the user could click the UXP button that they wanted to create a checkbox for, and Ps would somehow capture it. Once captured, the user could assign their preferred keyboard shortcut to that item. I know that’s probably asking for a lot, but it would be nice to make it as easy as possible for developers and users.

I think the first step would be to get the Plugins submenu items (plugin commands) into the kbsc dialog.

The “capture a button click” is more of a challenge since the dialog is constructed to map the key to a menu item. Functionally, this wouldn’t be much different than recordAction. Changing the dialog would likely be the larger amount of work.

The workaround right now is the old standby of record an Action and assign one of the F# keys.

1 Like

How would this be possible in a not-sane way? I really need to add some shortcuts to my plugin, I don’t care how. I just need to run some code when some keys are pressed. If I need to hardcode the keybinds/make my own settings menu then so be it. I tried adding onkeydown handlers in JS to the document/to my elements but that doesn’t seem to be working.

You would find where Photoshop stores this settings, rewrite that I believe XML file and restart Photoshop.

Maybe instead of restart you could switch shortcut preset but that is probably not recordable.

It seems like these are psp files, some binary format, unless I’m looking in the wrong place (appdata/roaming/adobe/adobe photoshop 2024/adobe photoshop 2024 settings)

As an alternate idea, I created a UXP command to do what I want, and now I’m trying to create an ExtendScript/JSX to invoke that command (then I can assign a keybind to the jsx script). I used the script listener plugin to generate the jsx for clicking my uxp command in the plugins menu, but when running that jsx I get “General Photoshop error occurred”.

Does anyone know if that method would be possible? If so, how?

If you are just trying to find a workaround for using a hotkey for a plugin action for your private use, maybe just make your uxp action recordable and then assign a hotkey for an action that triggers the function you want.

1 Like

I think .psp binary format follows IFD records structure similar as IFD in Tiff files.

Want to give this topic a nudge because keyboard shortcuts for UXP Plugins is super important for me, as well. Its such a obvious functionality, I can’t believe it hasn’t been implemented, yet.