Last active
August 11, 2016 20:20
-
-
Save maxgribov/e366c88dd5e0ee359925552faf6e0e83 to your computer and use it in GitHub Desktop.
Print Mac OS X Text Input Source Services
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> | |
*/ | |
- (void)printInputSources { | |
CFArrayRef sourceList = TISCreateInputSourceList (NULL, true); | |
int sourceCount = CFArrayGetCount(sourceList); | |
for (int i = 0; i < sourceCount; i++) { | |
NSMutableDictionary *property = [NSMutableDictionary dictionary]; | |
[property setObject:(__bridge id _Nonnull)(TISGetInputSourceProperty(CFArrayGetValueAtIndex(sourceList, i), kTISPropertyLocalizedName)) forKey:@"kTISPropertyLocalizedName"]; | |
[property setObject:(__bridge id _Nonnull)(TISGetInputSourceProperty(CFArrayGetValueAtIndex(sourceList, i), kTISPropertyInputSourceType)) forKey:@"kTISPropertyInputSourceType"]; | |
[property setObject:(__bridge id _Nonnull)(TISGetInputSourceProperty(CFArrayGetValueAtIndex(sourceList, i), kTISPropertyInputSourceID)) forKey:@"kTISPropertyInputSourceID"]; | |
[property setObject:(__bridge id _Nonnull)(TISGetInputSourceProperty(CFArrayGetValueAtIndex(sourceList, i), kTISPropertyLocalizedName)) forKey:@"kTISPropertyLocalizedName"]; | |
NSLog(@"%@", property); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment