1

I need to temporarily block the sequence cmdoptesc: I developed a formal examination test app for my students, and I need them to not get out of the test other than clicking a button in the test window.

BetterTouchTool accepts any shortcut except that (it seems to me, but I might make mistakes) I tried any combination, but always the forced quit window appears, as well as it happens in System Preferences > Keyboard > etc as suggested in "MacBook Pro, Yosemite: change Finder shortcuts".

I run Yosemite 10.10.5 and intend to stay with it until further upgrades will keep my Adobe suite working.

1

To get this to work you have to use a third party tool: Karabiner.

In the example below the key combination cmdoptesc darkens the monitor.

  1. Download, install and open Karabiner
  2. Open in the menulet Karabiner -> Preferences
  3. Open the tab Misc & Uninstall
  4. Hit the button Open private.xml
  5. Open the file private.xml with an appropriate editor
  6. Enter the customized keycode

    <?xml version="1.0"?>
    <root>
        <item>
            <name>Disable Command Option Escape</name>
            <identifier>disable_cmd_alt_esc</identifier>
            <autogen>__KeyToKey__ KeyCode::ESCAPE, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, ConsumerKeyCode::BRIGHTNESS_DOWN</autogen>
       </item>
    </root>
    
  7. Save the file

  8. Open in the menulet Karabiner -> Preferences the tab Change Key
  9. Hit the ReloadXML button
  10. Enable the remapping. It should be listed at the beginning.

You may refine the customized key code by adding a shortcut to brighten the monitor again to avoid a totally darkened screen and a helpless student sitting in front of it - unable to continue the test:

<?xml version="1.0"?>
<root>
    <item>
        <name>Disable Command Option Escape</name>
        <identifier>disable_cmd_alt_esc</identifier>
        <autogen>__KeyToKey__ KeyCode::ESCAPE, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, ModifierFlag::COMMAND_L, ConsumerKeyCode::BRIGHTNESS_DOWN</autogen>
        <autogen>__KeyToKey__ KeyCode::ESCAPE, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, ModifierFlag::COMMAND_R, ConsumerKeyCode::BRIGHTNESS_UP</autogen>
   </item>
</root>

In the first configuration each key combination (cmd_l/ralt_l/resc) darkens the screen. In the second configuration cmd_lalt_l/resc darkens and cmd_ralt_l/resc brightens the screen.

Karabiner also allows you to define application-only key codes. By adding your app to /Applications/Karabiner.app/Contents/Resources/appdef.xml or to private.xml you can restrict the customized key code to your app's realm. Below the <identifier> tag you have to add a line <only>Your_App's_Name</only> then.


Depending on your app you probably have to disable some other shortcuts too: e.g. cmdQ. Additionally you may have to hide Karabiner in the menubar.

  • Tank you so much! I'll try ASAP! cmd-Q and others (like screen saver commands, in order not to have the questions copied and diffused on socials...) are already intercepted, but cmd-opt-escape was a stone wall... thank you again – user185912 Aug 23 '16 at 12:29
  • Works like magic! – user185912 Aug 23 '16 at 13:08
  • One more problem though, but i think I'll be able to solve it: the apple option force quit is still available, but I'll remove the menu and use a document window. Or Karabiner can disable that as well? Thanks anyway. MC – user185912 Aug 23 '16 at 13:11
  • @user185912 You can disable the shortcut with Karabiner. To remove the shortcut completely you have to hack the (AKAIK) Finder.app – klanomath Aug 23 '16 at 13:14
  • @user185912 Hmm just checked Karabiner again. Power Button support removed since 10.9. It may still be possible to disable a short cut containing the power button with Karabiner. This is the power button: ⎋ isn't it? – klanomath Aug 23 '16 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .