Current input source icon

Thanks! Icon is not showing though. Am using latest stable BTT in conjunction with latest stable version of GoldenTouch

Could you please invoke the script from the terminal and paste its output to this image converter? The output might end with a %, don't copy it, just the part that ends with =

yes, that generates the correct icon in the image converter

Interesting. What happens when you press "Run Script" in the script editor? Does it show any output on the right?

Just a quick note without really adding anything helpful:
Unfortunately Apple seems to have forgotten about JXA, it has soo many bugs and is barely usable.
However one of the next BTT versions will allow to have custom widgets as NSBundles (I will make a Xcode template / example widget available), then it will become very easy to integrate such native code.

2 Likes

These are amazing news, would be happy to alpha-beta-whatever test this feature!

syntax error: a class can't go after this identifier

In fact, could you please make sure that the combobox in the left-center side of the window says "Java Script for Automation"? I don't see anywhere in the preset indication of using it instead of AppleScript.

Actually there's an indication, but it seems to be ignored by BTT:

"BTTScriptType":1

Just tried to import the widget myself, it sets the language to AppleScript
@Andreas_Hegenberg seems to be a bug :slight_smile:

that might ve an export/import bug then. I'll have a look!

1 Like

I deleted and re-imported the script, changed the combobox from "AppleScript" to "JavaScript", and restarted BTT. Now it works

Would be neat if tapping the icon switched to the next language. I tried mapping to CAPS LOCK but no luck. (I have 3 input sources enabled: US, Hebrew-QWERTY, and Greek [for math/sci symbols].)

Yeah, CAPS LOCK doesn't seem to work :-/. I guess the solution would be to assign a custom shortcut to language switch and then use it in BTT:


Yeah, I'll assign something I don't really use — option-space invokes Alfred on my machine...

OK, turns out I had command-space also assigned. I had to briefly turn it off so I could enter the shortcut, then turn it on again. There is, of course, a lag of about two seconds for the icon in the touchbar to be updated, but it updates immediately on the menu. I can live with that

1 Like

One challenge with this script is that IconRef could return NULL if it's not defined for a given input source such as is the case with japanese keyboards.

I've submitted a PR to your code that supports those languages.

Looks good, merged. Thank you :slight_smile:

My Caliguvara Preset has a shell script widget integrated doing basically the same thing. The only hiccup compared to @kovpas' solution is, that you'll have to add manually the languages you want to be able to see displayed, where your widget just needs another tool being installed. Advantage, you can change the language input by tapping the icon. Maybe this could be an idea for version 1.1 :wink:

It doesn't work on Catalina. Installed the binary, imported the widget, checked the settings, nothing shows up on the touch bar.