pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.25k stars 829 forks source link

Disable ESC key to quit full screen for ALL apps #2110

Open hasanhameed20 opened 4 years ago

hasanhameed20 commented 4 years ago

I know the link to disable esc key on Safari ONLY https://pqrs.org/osx/karabiner/complex_modifications/#safari Can I disable esc key quit fullscreen shortcut globally or just for word for Mac (it has other uses for the ESC key that I want to keep). Trying to look this up everywhere but no success yet. Would appreciate help!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j-f1 commented 4 years ago

Same here

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j-f1 commented 4 years ago

This is still an issue.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j-f1 commented 4 years ago

Please stop marking this issue as stale. Just because it hasn’t been updated recently doesn’t mean the feature shouldn’t be implemented.

GarageMan commented 3 years ago

I would be interested in the solution on this request due to I am having the same issue. I don't want the windows size of Office apps running on macOS to be reduced from "Full Screen" to any other size by (accidentally) pressing ESC.

I am a Karabiner-noob, just experienced enough to setup my Keychron K2 for Mac-usage :-)

MuhammedZakir commented 3 years ago

To disable escape key,

  1. Save below code as json file in ~/.config/karabiner/assets/complex_modifications/. E.g. disable_ESC.json
  2. Go to Preferences > Complex modifications > click Add rule
  3. Select Disable Escape Key from the list and click Enable

This works for Safari. For other apps, just add their file paths to 'rules > conditions > file_paths' list in the config. You can find file path of an app in 'Karabiner-EventViewer app > Frontmost application'.

Note: When you change a config file in '~/.config/karabiner/assets/complex_modifications/', you will have to remove that rule from Complex modifications tab and add it again.

Edit: You can also access EventViewer in Karabiner-Elements menu > Launch EventViewer.

{
  "title": "Disable Escape Key",
  "rules": [
    {
      "description": "Disable Escape Key",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "escape",
          "modifiers": {
            "optional": ["caps_lock"]
          }
        },
        "conditions": [{
          "type": "frontmost_application_if",
          "file_paths": [
            "/Applications/Safari.app/Contents/MacOS/Safari"
          ]
        }]
      }]
    }
  ]
}

Edit: This will disable escape key if it is pressed alone or if caps lock is enabled.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j-f1 commented 3 years ago

This is still open

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mamajjo commented 2 years ago

I've managed to solve my problem. I become annoyed because recently Firefox got the feature "ESC to exit fullscreen". What I've done to resolve it: 1) install Karabiner 2) open it then go to Complex Modifications -> Add rule -> Import more rules from the Internet -> find "Don't exit fullscreen when pressing ESC in Safari" and import it. 3) open json file which can be found inside: /Users/majchr/.config/karabiner/assets/complex_modifications 4) copy remove all its content and replace it with one mentioned above @MuhammedZakir 5) update file_path to desired application (in my case: /Applications/Firefox Developer Edition.app/Contents/MacOS/firefox) 6) save the file, go to Karabiners Complex Modifications and re-add the imported rule.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j-f1 commented 2 years ago

This is still an open question.

m-zheng commented 1 year ago

To disable escape key,

1. Save below code as json file in `~/.config/karabiner/assets/complex_modifications/`. E.g. `disable_ESC.json`

2. Go to Preferences >  Complex modifications > click `Add  rule`

3. Select `Disable Escape Key` from the list and click `Enable`

This works for Safari. For other apps, just add their file paths to 'rules > conditions > file_paths' list in the config. You can find file path of an app in 'Karabiner-EventViewer app > Frontmost application'.

Note: When you change a config file in '~/.config/karabiner/assets/complex_modifications/', you will have to remove that rule from Complex modifications tab and add it again.

Edit: You can also access EventViewer in Karabiner-Elements menu > Launch EventViewer.

{
  "title": "Disable Escape Key",
  "rules": [
    {
      "description": "Disable Escape Key",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "escape",
          "modifiers": {
            "optional": ["caps_lock"]
          }
        },
        "conditions": [{
          "type": "frontmost_application_if",
          "file_paths": [
            "/Applications/Safari.app/Contents/MacOS/Safari"
          ]
        }]
      }]
    }
  ]
}

Edit: This will disable escape key if it is pressed alone or if caps lock is enabled.

I can confirm this method works on safari. But it does not work if other keys have been remapped to 'escape' in karabiner, such as 'caps_lock'. In this case, the physical 'escape' key can no longer exit safari full screen, but the physical 'caps_lock' still can (because it is remapped to 'escape' in karabiner). @MuhammedZakir Do you have any suggestions to tackle this issue?

pzuraq commented 10 months ago

@m-zheng you can modify the rule that maps caps_lock to escape so that it does nothing for Safari or other apps.

But to the larger issue, there is a bigger problem that just disabling escape doesn't solve. The issue is that Escape is used all the time by many web apps and other applications to mean very useful things. For instance, on the web it can mean exit the current form input, or close a modal, etc.

Disabling escape entirely also disables all of this functionality, which has been embedded into many different webapps. We can't just map it to a different key combination in all apps because it's still really useful.

This is also true for many other applications that I've run into that implement escape-to-exit-fullscreen. I still haven't found a solution, but it would be really nice if Karibiner could do it somehow.