How to disable keyboard shortcuts in Mac OS X?

前端 未结 7 1610
囚心锁ツ
囚心锁ツ 2021-01-30 03:16

I would like to disable keyboard shortcuts Command-W and Command-Q in Mac OS X 10.8 Mountain Lion.

This is because they inter

7条回答
  •  庸人自扰
    2021-01-30 03:42

    Following an article on how to script shortcuts I tried setting a shortcut to '' to no avail, but setting it to NULL worked fine. Here's an example:

    TAB_KEY_SYMBOL="\\U21e5"
    COMMAND_KEY_SYMBOL="@"
    SHIFT_KEY_SYMBOL="$"
    
    defaults write com.apple.finder NSUserKeyEquivalents "{ 'Show Package Contents' = '${COMMAND_KEY_SYMBOL}${SHIFT_KEY_SYMBOL}O'; }"
    
    defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Sidebar' '\U0000'
    defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Dock' '\U0000'
    
    # kill finder and prefs daemon
    killall Finder
    killall cfprefsd
    
    # *only* if absent, add bundle id to make it show up in keyboard prefs pane
    defaults read com.apple.universalaccess "com.apple.custommenu.apps"
    defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add "com.apple.finder"
    
    $ defaults read com.apple.finder NSUserKeyEquivalents 
    {
        "Add to Dock" = "";
        "Add to Sidebar" = "";
        "Show Package Contents" = "@$O";
    }
    

提交回复
热议问题