Last active
May 3, 2023 16:54
-
-
Save pkamb/6128775 to your computer and use it in GitHub Desktop.
Get current Mac OS X keyboard layout.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Carbon/Carbon.h> | |
//Example: "com.apple.keylayout.US" or "com.apple.keylayout.Dvorak" | |
+ (NSString *)systemKeyboardLayout | |
{ | |
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource(); | |
CFStringRef layoutID = TISGetInputSourceProperty(source, kTISPropertyInputSourceID); | |
return (NSString *)layoutID; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment