Problem creating Function keys in touch bar

I've created a custom touchbar with the full 19 Fn keys. (using the "keyboard shortcut" action) It works great…to a point. But unlike the Apple built-in Fn key spread, my new one does not report modifier keys (e.g. shift-F6)

Anyone have any idea how I can fix this? Thanks very much,

Haven't tested but you should be able to do the action all in Applescript. Press Fkey -> detect modifier keys and then handle the logic there. I found this to check any modifiers down and seems to work. Pretty clever.

set modiferKeysDOWN to {command_down:false, option_down:false, control_down:false, shift_down:false}

if (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSAlternateKeyMask '") > 1 then
	set option_down of modiferKeysDOWN to true
end if

if (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSCommandKeyMask '") > 1 then
	set command_down of modiferKeysDOWN to true
end if

if (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSShiftKeyMask '") > 1 then
	set shift_down of modiferKeysDOWN to true
end if

if (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa. NSControlKeyMask '") > 1 then
	set control_down of modiferKeysDOWN to true
end if

return modiferKeysDOWN

I think in BTT currently the only option would be to have the touch bar buttons multiple times with different modifiers and make them send different shortcuts:

I should probably add an option that allows forwarding the currently pressed keys, but this is not yet possible.

Thank you both!

Imprint | Privacy Policy