And don't forget to install the localebase64icon binary before using the widget. The native code is relatively straightforward, the problem with lag would go away - currently icon refreshes every so often, so when you change input source, it may take some time to reflect the change on touch bar.Īnyway, here's the link to the widget, hope it would be useful for someone. As you can see, the process for getting iOS 16.3.1 on your iPhone is very easy and straightforward. Enter the Passcode on your iPhone if prompted. Click on Check for Update in the Summary pane. I believe that this widget should be a part of default widget set. Under Finder, click on the device icon at the top left to go to the device tab. Var icon = app.doShellScript(localeBase64Script) Var localeBase64Script = "/usr/local/bin/localebase64icon" So current solution is to use an external binary: var app = Application.currentApplication() Apparently initWithIconRef expects some other type of IconRef. Var image = $.(iconRef) Įxcept this code doesn't work, it produces an error (not a crash luckily) "Ref has incompatible type". Var iconRef = $.TISGetInputSourceProperty(currentSource, $.kTISPropertyIconRef) NSImage *image = initWithIconRef:iconRef] įair enough, this could be easily translated to JXA: var currentSource = $.TISCop圜urrentKeyboardInputSource() IconRef iconRef = (IconRef)TISGetInputSourceProperty(currentSource, kTISPropertyIconRef) ![]() It looks like macOS doesn't expose input source icons as files, so you have to use Carbon API to get it: TISInputSourceRef currentSource = TISCop圜urrentKeyboardInputSource() There are a couple available on this forum, but all of them suffer from the very same problem - they don't show original macOS input source icon. One last missing piece was an input source switcher. Nothing works - straight crash.Īnyway, I managed to make the widget work and looked at my touch bar. You can't use it at all: creating, getting it as a result of another method, even NSZeroRect. ![]() The biggest issue probably was that Mojave just crashes when you try to work with NSRect structure from JXA. Had a minor problem with making NSBezierPath working, but nothing I couldn't figure out. I wrote a widget that shows a precipitation forecast by using buienalarm API. So I was quite fascinated by the fact that you actually can almost write an objective-c code with Javascript for Automation (JXA). Story about trying to get the icon without external binary The source of this tool is also available, so you can build it yourself. In order to make it work you need to download localebase64icon binary and put it into /usr/local/bin/. This widget shows native input source icon.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |