First TouchBar project - Need some feedback - Chrome search from touchbar + interactive

Hello, new OS X user (MBP 15 with TouchBar).

So, Google chrome has the default click-to-navitage-or-search touchbar button, but I wanted something more. It was annoying that I had to lift my head up to the screen to see my typed search string.

So, I googled, found BetterTouchTool, and decided to give it a go, I got almost everything working.

  1. BetterTouchTool has a "Run script and show return value" widget that is shown only for chrome.
  2. When this button is clicked, it send Command+L or the key combination to focus on the NavigationBox, and it types "TouchBarDict" and hits Tab.
  3. This starts an Omnibox session handled by a chrome extension I have just written, the extension listens for the string the user is entering, and sends GET requests to BetterTouchTool webserver, with updateWidget text=<search_or_url_string> - Basically it shows what the user is typing right there in the TouchBar instead of lifting the eyes to the monitor.

It's working. But for it to be polished and nice there are a few things I could improve.

  1. chrome.omnibox.onInputChanged will only fire after the first letter has been entered into the omnibox. This means I have to chain actions in BetterTouchTool to change the text to something like "Start typing to search or navigate..." when before that I was displaying "Click to search or navigate".

  2. If the user doesn't type anything but actually clicks ESCAPE in the omnibox, I get no events for this, because no text was ever entered, there is nothing to cancel, chrome won't fire an event about that. Now the widget text is "Start typing to search or navigate..." and I want it to go back to "Click to search or navigate"

  3. I want the width of the widget to take all available space in touchbar, right now it is shrinking to contain text size + some margins.

Thanks in advance for any tips, or feedback.
Eitam.

Very cool!

1.) Unfortunately I also can't see a way to get notified about a click. Maybe you could use a conditional activation group, but this will match any text field:

2.) Doesn't the chrome.omnibox.onInputCancelled get triggered in that case?

3.) Fixed size widgets will soon be available, currently I think there is no way to do that unfortunately. (Maybe padding the string with spaces)

  1. Interesting, the reason I went through all this trouble is because I can't for the life of me use the mbp keyboard like a normal person, mind you I have been gaming and programming all my life (i am 34), I need to get used to the MBP keyboard. So, having the widget display all text inputs might be very interesting. Can type while seeing the input, passwords, search queries, new folder name, endless!

  2. No, if not even a single letter was entered, there is nothing to cancel, I got console.log on all events. Basically there is no omnibox session, so nothing to cancel. I was thinking about automating a single letter insert and removal with BetterTouchTool :wink:

  3. Cool!

Another interesting point, Maybe BetterTouchTool needs a more general purpose Chrome Agent that will basically hook BetterTouchTool to an extension like I have created but for more general use, I don't mind helping out building it if that's an adventure you would like to seek....

BetterTouchTool is awesome - Just had to add that.

If you wanna see it in action :

hello! do you happen to have that chrome extension by chance?

Sure, this is just the extension, it will not work without BTT properly configured though...

https://drive.google.com/open?id=1V2f4gz2l01pJFy1283KTL7tXwlSm8OaV