Prompt with List

Is it possible to configure items to trigger different actions depending on whether a modifier key is pressed? Or maybe even to have different states so the title/subtitle could reflect that?

I might be thinking too much!

you can check the modifier key state from java script:

let pressedKeys = await get_string_variable("currently_pressed_keyboard_keys");

if(pressedKeys.contains("58,") {
 // opt pressed
} else if(pressedKeys.contains("55,") {
 // cmd pressed
} else if(pressedKeys.contains("59,") {
 // ctrl pressed
}  else if(pressedKeys.contains("63,") {
 // fn pressed
}

Modifying the title while the prompt is open currently won't work because the JSON is only retrieved initially and not updated on modifier key changes. That might be an option for an upcoming version :wink:

2 Likes

Thanks! That's helpful!

This seems to work well now. Thanks!

One other idea for search: Would it be possible to add a generic, hidden meta field or something similar that could also be matched against but without needing to show in the UI.

I'd have two use cases for it with my citation picker:

  1. Some of the items have a long list of authors, and it would be nice to make the item title something like First Author Surname, et al . Year. Truncated Title instead of what currently happens: Author 1, Author 2, Author 3, Author 4, Auth...Truncated but still be able to match on any author name.
  2. Filter by the type of item (e.g., book, journal article, chapter, etc). I'm currently using the item's type to set the icon, but it might be useful to match on as well.

Something like this could also be useful for those using it to search for BTT triggers and actions.

Today I've noticed that if I trigger the action, then navigate through some of the items with the arrow keys, then hit ESC, the prompt list exits without inserting any text, as expected. However, later if I'm editing a text field in BTT's configuration window (like when editing the script itself in BTT, for example), the accumulated output of every time I have hit ESC with a selected/focus item is pasted into the BTT text field at the cursor location. Something like @authorName2002@authorName1997@authorName2016@authorName2008. Sometimes longer, sometime shorter.

It only happens occasionally (often), not every time.

This is the action for the chosen item:

        action: {
            js: `(async () => {await paste_text({text: '@${item.id}', insert_by_pasting: true})})()`
        }

Any ideas?

thanks for reporting, I'll have a look!

1 Like

should be fixed in 4.710! there is now also an optional "meta" property that is included in the search but not displayed

1 Like

Thanks for both of these!

Did something change with setting color/background color for the icons?

I noticed today (with 4.719 and now 4.720) icons are no longer showing up with the following setting:

icon: `sfsymbol::${icon}::size@@4::color@@#b0b0b0::background@@#FFFFFF00`

I tried changing the values for color/background, but it didn't seem to make a difference.

It seems to work if I remove background specification entirely (although with the wrong color of course).

ah sorry I broke something when I added support for icon properties width@@ and height@@ (Show folder content in custom context menu - #3 by Andreas_Hegenberg )

Should be working again in v4.721!

1 Like

Thanks for the update! Sorry for the delay in responding. I ended up losing internet that afternoon due to weather issues, and it just came back today! It is working now for me. Thanks!