Home
Random
Log in
Settings
About freem
Disclaimers
freem
Search
Editing
Openai/6942c9db-f3dc-8013-b29c-ff520370a65f
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{DISPLAYTITLE:Override keybinds with Tampermonkey}} ''This conversation was exported from ChatGPT''<ref>{{cite web|title=Override keybinds with Tampermonkey|url=https://chatgpt.com/share/6942c9db-f3dc-8013-b29c-ff520370a65f|publisher=ChatGPT|access-date=2025-12-17}}</ref> == gpt-5-2-thinking == === User: how can I override keybinds with tampermonkey? === 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: === 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: <syntaxhighlight lang="js">// ==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 }); })(); </syntaxhighlight> ===== How to use it ===== # Tampermonkey → Create a new script # Paste the code above # Save # Refresh ChatGPT ===== Notes / tweaks ===== * If you don’t want to treat Cmd as Ctrl on macOS, change: ``<code>js const ctrl = e.ctrlKey || e.metaKey; </code>`<code> to: </code>`<code>js const ctrl = e.ctrlKey; <syntaxhighlight>- If the site still catches it (rare), add a second listener on document too: </syntaxhighlight>js document.addEventListener("keydown", handler, { capture: true }); </code>`` 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 == <references /> [[Category:ChatGPT Shares]] [[Category:openai]]
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cite web
(
edit
)
Module:Citation/CS1
(
edit
)
Module:Citation/CS1/COinS
(
edit
)
Module:Citation/CS1/Configuration
(
edit
)
Module:Citation/CS1/Date validation
(
edit
)
Module:Citation/CS1/Identifiers
(
edit
)
Module:Citation/CS1/Utilities
(
edit
)
Module:Citation/CS1/Whitelist
(
edit
)
Module:Citation/CS1/styles.css
(
edit
)