我有个问题。我的 Mac 中有两种键盘布局,因为我必须在与不同的人交流时输入两种不同的语言。我使用键盘快捷键Cmd+Space
从一种布局(语言)切换到另一种布局。
我想知道我是否可以在Cmd+Space
按下时运行自定义脚本?我知道有一个名为Punto Switcher的应用程序可以做到这一点。
我的想法是更改键盘突出显示级别以指示当前语言。
- Bright = 德语(或俄语或其他)
- 昏暗 = 英语
问题是在哪里可以找到可以
- 在 Mac OS X 中截取键盘布局
- 改变键盘高亮的亮度
我有个问题。我的 Mac 中有两种键盘布局,因为我必须在与不同的人交流时输入两种不同的语言。我使用键盘快捷键Cmd+Space
从一种布局(语言)切换到另一种布局。
我想知道我是否可以在Cmd+Space
按下时运行自定义脚本?我知道有一个名为Punto Switcher的应用程序可以做到这一点。
我的想法是更改键盘突出显示级别以指示当前语言。
问题是在哪里可以找到可以
来自@Anoop Vaidya 的指向 LED 亮度的简洁指针——看起来很有趣!
当输入法发生变化时,系统会发送通知。
首先,声明一个函数来接收通知:
void theKeyboardChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSLog(@"Keyboard/input method changed.");
}
然后注册更改通知:
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(),
myContextInfo, theKeyboardChanged,
kTISNotifySelectedKeyboardInputSourceChanged, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
我找到了 Amit Singh 的博客,他在未记录的 API 中给出了想法,他使用了 C,为此,您肯定可以从中找到某种帮助。
或者您可以尝试使用以下代码:
UInt64 lightInsideGetLEDBrightness(){
kern_return_t kr = 0;
IOItemCount scalarInputCount = 1;
IOItemCount scalarOutputCount = 1;
UInt64 in_unknown = 0, out_brightness;
kr = IOConnectCallScalarMethod(dataPort, kGetLEDBrightnessID, &in_unknown, scalarInputCount, &out_brightness, &scalarOutputCount);
return out_brightness;
}