I've been leaning heavily on macOS's ability to let you specify custom keyboard shortcuts via
~/Library/KeyBindings/DefaultKeyBinding.dict. It's essentially a system-wide mapping of shortcuts to the input system on macOS and overrides the system defaults in
As an example, I map the
Home key to the selector
moveToBeginningOfLine: like on Windows, and now anywhere in macOS that uses standard Cocoa controls, home moves to the beginning of the line without me having to do per-app overrides of shortcuts.
However, some apps like Slack don't respect these global shortcuts and instead intercept the keys themselves, rendering it useless. I'm trying to set BTT up to have a keyboard-specific override where I can send the selector from there.
As mentioned in other posts here, I tried to use BTT to just intercept, then re-send out the corrected key strokes, but I need to swap two, and BTT then ends up recursuvely triggering it. There was talk that this was fixed, but it still exists, even in the latest versions of BTT (as of 5/12/2023) so I can't use that.
If BTT had a way to send a selector however, I wouldn't need to re-trigger any keys. I would simply send the proper selector and be done with it. However, I don't see any way to do that.
Essentially, the code I'd love to see BTT is this, but on a global, not app-scale.
let selectorName = "moveToBeginningOfLine:" let selector = Selector(selectorName) // Sending to nil means 'first responder'system-wide NSApplication.shared.sendAction(self, to: nil, from: sender)
The above works, but only in the current application. I'm trying to send that selector to whichever app has the focus. Hoping BTT can do something like this (or even if it can't/you don't want to add it, if you know how to do so, I can put it in my own command-line app that I simply shell to from BTT.