Use Modifiers with "Prompt With List"

I'd like to combine modifiers with using "Prompt With List". Think something like using ⌘↩ to reveal files in Alfred/LaunchBar. I can get a decent approximation, but there are issues:

  • ⌘↩ does not work
  • most combos don't work (e.g. ⌥⇧↩)
  • slower. you'll need to hold the modifiers a bit longer than something like Alfred/LB

I'm using the following shell command from this source:

python -c 'import Cocoa;m=Cocoa.NSEvent.modifierFlags();print m&Cocoa.NSShiftKeyMask>0,m&Cocoa.NSControlKeyMask>0,m&Cocoa.NSAlternateKeyMask>0,m&Cocoa.NSCommandKeyMask>0'

What is the output you want to get? Do you want to pass "a⌘↩"?

Edit: If you use a trigger such as ⌘↩ you can append it using %TriggerValue%

I want different actions to happen based on the modifiers down when the selection was made. In my particular example above, the list options were arbitrary. Maybe this would be more clear:

Use Modifiers with Prompt With List.kmmacros (4.9 KB)

You probably need something like this:

Thanks, this works as well for the mods and it might be quicker than the shell script.

The issue I'm having isn't so much getting the mods as it is using them with "Prompt with List". ⌘↩ will not select the current item and this is true for most of the possible modifier combos. At least on my system, it seems inconsistent which ones work. For example, ⌃⌘↩ works but ⌥⌘↩ does not. Can you select items with any of the combinations I mentioned?

A simple solution I’d try is

  1. use for triggering the macro “ ⌘↩F”, And “ ⌥⌘↩F”.
  2. Then pass that combination down using trigger value to do Action A or B for the selected item.
1 Like

Re-upping this because I just tried to do something similar and wasted a few minutes because you can use modifier combos like Option-Return and Shift-Return to select from Prompt With List, but not Command-Return (which just beeps).


Hi, @gruber. During my testing of Prompt with List, I found that there were only five modifier combinations that can be used with <return>–:

1 Modifier Key

  • ⌃⏎ YES
  • ⌥⏎ YES
  • ⇧⏎ YES
  • ⌘⏎ PWL stalls and beeps

2 Modifier Keys

  • ⌃⌥⏎ PWL stalls and removes Select Entry
  • ⌃⇧⏎ YES
  • ⌃⌘⏎ PWL stalls
  • ⌥⇧⏎ YES
  • ⌥⌘⏎ PWL fails with no selection
  • ⇧⌘⏎ PWL stalls and beeps

3 Modifier Keys

  • ⌃⌥⇧⏎ PWL stalls and removes Select Entry
  • ⌃⌥⌘⏎ PWL stalls
  • ⌃⇧⌘⏎ PWL stalls
  • ⌥⇧⌘⏎ PWL stalls

4 Modifier Keys

  • ⌃⌥⇧⌘ PWL stalls

On a related note, although it's not perfect, I found it helpful to provide a legend as the first line, e.g., with Markdown Link Tool:

The legend line in the Prompt with List can be effectively deactivated by using a double-underscore prefix in combination with an Until action:

Keyboard Maestro Export

DOWNLOAD Macro Actions:
Until.kmactions (1.6 KB)
WARNING: After downloading this macro, if you are editing a macro and import these actions, they will be inserted into the macro you are editing.

UPDATE: 2022-10-01

Keyboard Maestro v10.2 incudes a new related token: %PromptWithListModifiers%

This token makes it much simpler to provide alternate behavior when a modifier is down when a selection is made.

Also, with Keyboard Maestro v10.2, Prompt With List selections can be made with the Return in combination with more modifiers:

1 Modifier Key

  • ⌃⏎ YES
  • ⌥⏎ YES
  • ⇧⏎ YES
  • ⌘⏎ YES

2 Modifier Keys

  • ⌃⌥⏎ *PWL stalls and removes the Select Entry
  • ⌃⇧⏎ YES
  • ⌃⌘⏎ YES
  • ⌥⇧⏎ YES
  • ⌥⌘⏎ YES
  • ⇧⌘⏎ YES

3 Modifier Keys

  • ⌃⌥⇧⏎ *PWL stalls and removes Select Entry
  • ⌃⌥⌘⏎ *PWL stalls and removes Select Entry
  • ⌃⇧⌘⏎ YES
  • ⌥⇧⌘⏎ YES

4 Modifier Keys

  • ⌃⌥⇧⌘ *PWL stalls and removes Select Entry

Although the four combinations noted above do not seem to work in combination with Return, if the PWL selection is made by double-clicking the entry, the selection is made and the %PromptWithListModifiers% token properly indicates the state of the modifiers.

@peternlewis, thank you for making this awesome improvement! As one that prefers to use the keyboard and avoid the mouse when possible (to prevent ergonomic strain), %PromptWithListModifiers% is invaluable.

The "legend" line is interesting, thanks for suggesting this. I'm doing something similar but with the Title field, which, alas, means it doesn't show up when the default is prefilled to "all:". (I've sent a feature request to get "all:" behavior by default, with an empty search field, even with 100+ items in the list.)


I'd like to see that too, but based on @peternlewis's comment in this thread, it doesn't seem likely to change.

1 Like

This is done for the next version with the %PromptWithListModifiers% token.

Also an option to Always Show All Entries.


I updated my post after retesting with Keyboard Maestro v10.2. Prompt With List has been significantly improved! :grinning:

1 Like