Last active
January 22, 2024 15:42
-
-
Save samsondav/e6a0a7740cdf955a88b590e781d96b62 to your computer and use it in GitHub Desktop.
Disable cmd+enter send in gmail
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 cmd+enter | |
// @namespace sampdavies@gmail.com | |
// @description Disables cmd+enter from sending an email in gmail | |
// @include ^https?:\/\/mail\.google\.com.*$ | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
(function(){ | |
var isMac = unsafeWindow.navigator.oscpu.toLowerCase().contains("mac os x"); | |
unsafeWindow.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 = isMac ? e.metaKey : 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(); | |
return; | |
} | |
// s'more mac love | |
if (!isMac) { | |
return; | |
} | |
}, true); | |
})(); |
Great idea, I tried today on both Firefox (using Greasemonkey) and Chrome (Tampermonkey) but it does not work for me, Ctrl-Enter still works and the message is sent (anyway I still can stop it with the Undo option).
It's just me?
For me this didn't work anymore.
I created an updated version here:
https://gist.github.com/PatrickvEk/c942b0e2bb0b9f9d34b33820aab07ec5#file-disable-gmail-cmd-enter-2024-user-js
I hope it works for everyone that finds this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome!