Last active
January 22, 2024 15:44
-
-
Save PatrickvEk/c942b0e2bb0b9f9d34b33820aab07ec5 to your computer and use it in GitHub Desktop.
Gmail Disable accidental sending Ctrl+Enter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gmail Disable accidental sending | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-01-22 | |
// @description Disable Ctrl+Enter to send, in order to prevent accidental sending | |
// @author Patrick van Ek | |
// @match https://mail.google.com/mail/* | |
// @icon https://mail.google.com/favicon.ico | |
// @grant none | |
// ==/UserScript== | |
// INSTALL TAMPERMONKEY IN YOUR BROWSER TO USE THIS SCRIPT | |
(function(){ | |
window.document.addEventListener('keydown', function(e) { | |
// Mac uses the Command key, identified as metaKey | |
// Windows and Linux use the Control key, identified as ctrlKey | |
var modifier = e.ctrlKey; | |
// abort if the proper command/control modifier isn't pressed | |
if (!modifier) { | |
return; | |
} | |
switch (e.keyCode) { | |
case 13: // Enter - (disable cmd-enter to send in gmail) | |
e.stopImmediatePropagation(); | |
console.log("Prevented accidental send"); | |
return; | |
} | |
}, true); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment