Jump to content

Openai/6942c9db-f3dc-8013-b29c-ff520370a65f

From freem
Revision as of 05:35, 18 December 2025 by Lukegao (talk | contribs) (by freem.ai...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This conversation was exported from ChatGPT[1]

gpt-5-2-thinking[edit | edit source]

User: how can I override keybinds with tampermonkey?[edit | edit source]

how can I override keybinds with tampermonkey?

I have already deleted two great chats on accident (including a nice cooking recipe) by typing fast and hitting Shift+Ctrl+Backspace and then Enter since the "Confirm" button is automatically highlighted. I think it happened when I'm trying to add a newline without sending the message with Shift+Enter. It feels so stupid how easily and fast it happens, I don't know if it happens easier if the chat is laggy or if my fingers are just clumsy.

Has anyone else had this happen to them? There doesn't seem to be a way to change keybinds.

They seriously should change this or at least have the dialog auto-focus on the "Cancel" button when you invoke it.

I want to null out shift ctrl backspace

Assistant: Yep — you can “null out” a key combo with Tampermonkey by catching the keyboard event early capture phase and calling:[edit | edit source]

Yep — you can “null out” a key combo with Tampermonkey by catching the keyboard event early (capture phase) and calling:

  • event.preventDefault() (stops browser/default behavior)
  • event.stopImmediatePropagation() (stops the site’s handlers)

Here’s a Tampermonkey userscript that blocks Ctrl+Shift+Backspace (and optionally Ctrl+Shift+Delete too), on ChatGPT:

// ==UserScript==
// @name         Block Ctrl+Shift+Backspace (ChatGPT)
// @namespace    local
// @version      1.0
// @description  Prevent accidental destructive hotkey
// @match        https://chatgpt.com/*
// @match        https://chat.openai.com/*
// @run-at       document-start
// ==/UserScript==

(function () {
  "use strict";

  function isBlockedCombo(e) {
    // Normalize key detection across browsers:
    // Backspace = "Backspace", Delete = "Delete"
    const key = e.key;
    const ctrl = e.ctrlKey || e.metaKey; // include Cmd on macOS if you want
    const shift = e.shiftKey;

    // Primary: Ctrl+Shift+Backspace
    if (ctrl && shift && key === "Backspace") return true;

    // Optional: also block Ctrl+Shift+Delete (uncomment if desired)
    // if (ctrl && shift && key === "Delete") return true;

    return false;
  }

  function handler(e) {
    if (!isBlockedCombo(e)) return;

    // Stop everything
    e.preventDefault();
    e.stopImmediatePropagation();
    e.stopPropagation();

    // Optional: tiny debug log
    // console.debug("Blocked hotkey:", e.key, { ctrl: e.ctrlKey, shift: e.shiftKey, meta: e.metaKey });
  }

  // Capture phase so we run before the page’s listeners.
  window.addEventListener("keydown", handler, { capture: true });
})();
How to use it[edit | edit source]
  1. Tampermonkey → Create a new script
  2. Paste the code above
  3. Save
  4. Refresh ChatGPT
Notes / tweaks[edit | edit source]
  • If you don’t want to treat Cmd as Ctrl on macOS, change: ``js const ctrl = e.ctrlKey || e.metaKey; ` to: `js const ctrl = e.ctrlKey;
    - If the site still catches it (rare), add a second listener on document too:
    js document.addEventListener("keydown", handler, { capture: true });
    ``

If you tell me your OS/browser (Windows/Mac/Linux + Chrome/Firefox), I can tailor the exact key detection (some keyboards/layouts report slightly differently).

References[edit | edit source]

  1. "Override keybinds with Tampermonkey". ChatGPT. Retrieved 2025-12-17.