I was wondering how feasible it would be to intercept the "enter down" event in the URL bar, copy the text to the clipboard, check to see if it matches the pattern, then expand the URL and paste it back in and press enter.
In particular, does anyone have an idea of how to detect when "enter down" happens within the search/url box, rather than in forms and the like within a webpage?
How about macro activated by a hotkey in your browser that displays a Prompt for User Input field for your search string, which you would enter just like Omnikey? Subsequent actions would expand the search string to go to a new tab in your browser with the expanded search URL.
Rather than using any type of hotkey or "key down", I'd suggest using a Typed String trigger in a Macro that is in a Macro Group activated ONLY for the Web Browsers of interest.
Since this can not determine if you are actually in the Browser Address bar, you need to choose a Typed String prefix that you will only use with in the Address Bar.
In this case I'd use a Typed String with RegEx, maybe something like this: ;w\.(.+)๐
where "๐" is the SPACE character
Use that for both the trigger, and then in a Search using Regular Expression action to set a KM Variable (like "Local__SearchStr") to the first Capture Group.
Using your example:
type "w arping" that expands into a wikipedia search url like "arping - Wikipedia".
you would type: ;w.arping๐
to get "arping" as the search term.
Assuming that you set the KM Variable "Local__SearchStr" to the first Capture Group, then use the KM Open a URL action, with this as the parameter for that Action: https://en.wikipedia.org/wiki/Special:Search/%Local__SearchStr%
Of course, you can use whatever URL search root you wish.
FWIW, I use this format of ";" as the prefix and "๐" as the suffix to trigger all of my typed string macros, and text expansion snippets with Typinator. This works very well to ensure no false positives.
I want to get a seamless experience, get it to work as close to the native safari search as possible. Probably the best option would be to use some kind of extension here, but for now I'm trying this approach with redirects from built in search to a custom Redirect URL