I did it on my own:
- First, I run "Set Function Key Mode / Media Key Mode"
- Then I run the following Apple Script:
set functionKeyMode to do shell script "ioreg -n IOHIDSystem | sed -n 's/.*\"HIDFKeyMode\"=\\([0-9]*\\).*/\\1/p'"
if functionKeyMode is "1" then
set modeText to "F1-F12"
else
set modeText to "Media"
end if
tell application "BetterTouchTool"
set_persistent_string_variable "BTTFunctionKeyMode" to modeText
end tell
- Output the HUD overlay with the variable {BTTFunctionKeyMode}