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.72k stars 836 forks source link

How to disable sysdiagnose key combination #1107

Closed nocLyt closed 6 years ago

nocLyt commented 6 years ago

I'm turning Caps Lock into Hyper modifier key. Hyper is Command-Shift-Option-Control.

However, there is one small problem: you might trigger the sysdiagnose command accidentally. Finder will open the sysdiagnose folder, well, diagnose your system, and zip the log results. Worst, sysdiagnose will drive the CPU performance crazy in order to diagnose your system.

sysdiagnose can be triggered upon pressing a special key chord; this is currently Command-Shift-Option-Control-Period (.).

How can I disable sysdiagnose key combination with Karabiner-Elements? or other ways?

xmwa commented 6 years ago

same problem here, tried other tools and no way to disable the combo.

Plus the cmd+opt+ctrl - . for increase contrast cannot be remapped neither.

JakobR commented 6 years ago

I got it to work with the following configuration:

{
  "title": "Change CapsLock to Command-Shift-Option-Control",
  "rules": [
    {
      "description": "Change CapsLock to Command-Shift-Option-Control modifier (or Escape when pressed alone)",
      "manipulators": [
        {
            "from": {
                "key_code": "caps_lock"
            },
            "to": [
                {
                    "set_variable": {
                        "name": "hyper_modifier",
                        "value": 1
                    }
                },
                {
                    "key_code": "left_shift",
                    "modifiers": [
                        "left_command",
                        "left_control",
                        "left_option"
                    ],
                    "lazy": true
                }
            ],
            "to_after_key_up": [
                {
                    "set_variable": {
                        "name": "hyper_modifier",
                        "value": 0
                    }
                }
            ],
            "to_if_alone": [
              {
                "key_code": "escape"
              }
            ],
            "type": "basic"
        }
      ]
    },
    {
      "description": "Disable Command-Shift-Option-Control-Period (.)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "period",
            "modifiers": {
              "mandatory": [
                "command",
                "shift",
                "option",
                "control"
              ]
            }
          }
        }
      ]
    },
    {
      "description": "Disable Command-Shift-Option-Control-Comma (,)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                "command",
                "shift",
                "option",
                "control"
              ]
            }
          }
        }
      ]
    }
  ]
}
stale[bot] commented 6 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.

acnebs commented 4 years ago

I'm having this issue but I'm not even hitting comma or period.

I have caps lock mapped to CMD+CTRL+OPTION+SHIFT and every time I hit that with "w", sysdiagnose gets triggered.

bnferguson commented 4 years ago

@acnebs Seems in Catalina they added a new Key combo for WiFi Diagnostics. You can see you probably have a bunch of files in /private/var/tmp from hitting it. Still trying to find a spot to disable it but I'm guessing this is pretty well wired into OSX if it responds even during system hang like SysDiagnose does.

connorcarr commented 4 years ago

For @acnebs, @bnferguson or anyone still following this thread, my workaround was to simply change the hyper key to shift+option+control. I had a lot of trouble getting that rule to stick, until I found an app to modify and have pasted my simplistic rule on "https://genesy.github.io/karabiner-complex-rules-generator/#eyJ0aXRsZSI6IkNoYW5nZSBjYXBzX2xvY2sga2V5IChyZXYgNCkiLCJydWxlcyI6W3siZGVzY3JpcHRpb24iOiJDaGFuZ2UgY2Fwc19sb2NrIGtleSB0byBjb250cm9sK29wdGlvbitzaGlmdC4gKFBvc3QgZXNjYXBlIGtleSB3aGVuIHByZXNzZWQgYWxvbmUpIiwibWFuaXB1bGF0b3JzIjpbeyJ0eXBlIjoiYmFzaWMiLCJmcm9tIjp7ImtleV9jb2RlIjoiY2Fwc19sb2NrIiwibW9kaWZpZXJzIjp7Im9wdGlvbmFsIjpbImFueSJdfX0sInRvIjpbeyJrZXlfY29kZSI6ImxlZnRfc2hpZnQiLCJtb2RpZmllcnMiOlsibGVmdF9jb250cm9sIiwibGVmdF9vcHRpb24iXX1dLCJ0b19pZl9hbG9uZSI6W3siaG9sZF9kb3duX21pbGxpc2Vjb25kcyI6MTAwLCJrZXlfY29kZSI6ImNhcHNfbG9jayJ9XX1dfV19".

I use slate so just edited the 'hyper' key variable to reflect this and now there's no sysdiagnostics happening every 5 mins.

There may be other problems with using this new key combination which I haven't foreseen but it works flawlessly for my use case.

I hope this helps.

mdentremont commented 2 years ago

@JakobR Thanks for the snippet, just an FYI: I also needed an ignore for "slash"

towry commented 1 year ago

@JakobR 's solution works, but it also make those key combination disabled and can not be used for other app.

catouse commented 1 year ago

For disable WiFi logging:

{
    "description": "Disable command+control+option+shift+, which triggers WiFi logging.",
    "manipulators": [
        {
            "from": {
                "key_code": "comma",
                "modifiers": {
                    "mandatory": [
                    "command",
                    "control",
                    "option",
                    "shift"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "f13"
                }
            ],
            "type": "basic"
        }
    ]
}
NightMachinery commented 9 months ago

I am mapping these hyper+,, hyper+. to my own hotkeys through Hammerspoon, but sometimes they trigger the OS diagnostics. Can I somehow disable the OS shortcuts?

Update: I also used this code to disable the hotkeys altogether, but Hammerspoon still intercepts the hotkeys first. This makes me think that there is a race condition between the OS, Karabiner, and Hammerspoon.

                {
                "description": "Disable command+control+option+shift+, which triggers WiFi logging.",
                "manipulators": [
                    {
                    "from": {
                        "key_code": "comma",
                        "modifiers": {
                            "mandatory": [
                                "command",
                                "control",
                                "option",
                                "shift"
                            ]
                        }
                    },
                    "type": "basic"
                }
                ]
            },
                {
                "description": "Disable command+control+option+shift+. which triggers sysdiagnose.",
                "manipulators": [
                    {
                    "from": {
                        "key_code": "period",
                        "modifiers": {
                            "mandatory": [
                                "command",
                                "control",
                                "option",
                                "shift"
                            ]
                        }
                    },
                    "type": "basic"
                }
                ]
            }