首页 > 其他分享 >[macos]hammerspoon设置

[macos]hammerspoon设置

时间:2023-11-01 10:06:27浏览次数:23  
标签:function macos set hammerspoon hs app 设置 input method

在init的 lua脚本中,下面的代码是为了在进入Terminal、ShortCat和Spolight的时候,默认切换到英文输入法

 

local function Chinese()

hs.console.printStyledtext("chinese")

hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC")

end

local function English()

hs.console.printStyledtext(hs.keycodes.currentSourceID())

hs.keycodes.currentSourceID("com.apple.keylayout.ABC")

end

local function set_app_input_method(app_name, set_input_method_function, event)

event = event or hs.window.filter.windowFocused

hs.window.filter.new(app_name)

:subscribe(event, function() set_input_method_function() end)

end

set_app_input_method('Hammerspoon', English, hs.window.filter.windowCreated)

set_app_input_method('Spotlight', English, hs.window.filter.windowCreated)

set_app_input_method('Shortcat', English, hs.window.filter.windowCreated)

set_app_input_method('Terminal', English)

 

 



标签:function,macos,set,hammerspoon,hs,app,设置,input,method
From: https://blog.51cto.com/u_15351164/8119147

相关文章

  • [macos]增加三指上滑呼出mission control的速度
    FirstyoucanchangethespeedofswitchingintoMissionControl(stillcalledExposeintheprefs).Todothatjustenterthiscommand:defaultswritecom.apple.dockexpose-animation-duration-int0;killallDockAndtogobacktodefaultsrunthiscommand......
  • [macos]karabiner-elements设置
    通过一些映射来方便我的mac操作      20200423:  https://github.com/eret9616/my-karabiner-config ......
  • [macos]magicmouse 配合 bettertouchtool实现触摸功能
       1.将所有的tap设置为左键点击2.2fingertap设置为右键点击3.3fingertap设置为lookupword4.2fingerswipeup和swipedown都设置为missioncontrol      其他优化: 将option+command+C设置为双击选中并复制       trackpad优化:  ......
  • [macos]macOS下的动画关闭
    Disableanimationswhenopeningandclosingwindows.(关闭打开一个窗口的动画,如:打开textEdit)defaultswriteNSGlobalDomainNSAutomaticWindowAnimationsEnabled-boolfalse  DisableanimationwhenopeningtheInfowindowinFinder(cmd⌘+i).(关闭command+i的动画暂......
  • [macos]移除dock中的Trash和Finder
    准备:在catalina下修改系统文件需要先输入以下命令(否则会提示只读) 步骤:https://github.com/jesscXC/hide-finder-trash-dock-icons......
  • [macos]mac os 的 show All操作
    使用command+H隐藏窗口后,有没有什么办法能把所有隐藏的窗口都展示出来呢  SystemPreferences>Keyboard>KeyboardShortcuts>select"ApplicationShortcuts">highlight"AllApplications">click"+">type"ShowAll"inthe"......
  • [macos]提高将mac os的键盘响应性
     除了在键盘中设置重复率速度,    还可以通过下面的操作,mac的英文输入法如果长按一个键的时候,是会去输入它的重音的,TohaverepeatingkeysenterthiscommandintheTerminaldefaultswriteNSGlobalDomainApplePressAndHoldEnabled-boolfalsethiswilldisablethediac......
  • [macos]os x 技巧: 关闭打字时候光标闪烁 no blink
     关闭光标闪烁:defaultswrite-gNSTextInsertionPointBlinkPeriodOff-float0defaultswrite-gNSTextInsertionPointBlinkPeriodOn-float999999999999http://www.jurta.org/en/prog/noblink......
  • 如何用电脑设置闹铃
    如何为win7电脑设置闹钟的详细方法由于手机的普及,现在有绝大部分人平时使用的闹钟都是用手机时钟,学生群体可能会用常规的闹钟。如果你也和我一样,突发其想,想用电脑做闹钟,那该怎么办呢。其实,我们经常使用的电脑也是可以设置闹钟的,想必还有很多人不清楚吧,下面就跟随小编一起来......
  • openGauss学习笔记-111 openGauss 数据库管理-管理用户及权限-用户权限设置
    openGauss学习笔记-111openGauss数据库管理-管理用户及权限-用户权限设置111.1给用户直接授予某对象的权限给用户直接授予某对象的权限,请使用GRANT。将Schema中的表或者视图对象授权给其他用户或角色时,需要将表或视图所属Schema的USAGE权限同时授予该用户或角色。否则用户或......