I want to get keyboard layout something like GetKeyboardLayout(threadId) in Windows. threadId is id of application with active window. I want to translate virtual key code to char of current language.
Now I use TISCopyCurrentKeyboardInputSource() function but it don't have parameters and it return only "U. S." language. I think this is layout of daemon. Also I can't convert code with TISInputSourceRef of TISCopyInputSourceForLanguage(language) function. It return only US characters.
UPDATE: Okey. I find solution of converting keyCodes. I jast call function UCKeyTranslate with parameter modifiers equal 0. But I cant't find how to get input source of active window or just any running application.
UPDATE 2: plist path is /Library/LaunchAgents
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.keylogger</string>
<key>Program</key>
<string>/Users/Titan/Desktop/keylogger</string>
<key>ProgramArguments</key>
<array>
<string>keylogger</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>