Last active
January 12, 2016 23:33
-
-
Save execjosh/9682490 to your computer and use it in GitHub Desktop.
Confirm Quit for Atom v0.75.0
This file contains hidden or 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
--- a/Atom.app/Contents/Resources/app/src/workspace-view.js | |
+++ b/Atom.app/Contents/Resources/app/src/workspace-view.js | |
@@ -153,7 +153,37 @@ | |
this.command('application:show-settings', function() { | |
return ipc.sendChannel('command', 'application:show-settings'); | |
}); | |
+ var quitDoubleTapTimeout = null | |
+ function showConfirmQuitMsg() { | |
+ $('<div>') | |
+ .attr({ | |
+ 'class': 'overlay from-top' | |
+ , id: 'confirm-quit-msg' | |
+ }) | |
+ .html('<h1>Press ⌘ again to Quit</h1>') | |
+ .appendTo('body') | |
+ } | |
+ function hideConfirmQuitMsg() { | |
+ $('#confirm-quit-msg').fadeOut(function() { | |
+ $(this).remove() | |
+ }) | |
+ } | |
this.command('application:quit', function() { | |
+ if (atom.config.get('core.hacks.confirm-quit')) { | |
+ if (null == quitDoubleTapTimeout) { | |
+ showConfirmQuitMsg() | |
+ console.debug('waiting for second quit request...') | |
+ quitDoubleTapTimeout = setTimeout(function() { | |
+ console.debug('no second quit request!') | |
+ quitDoubleTapTimeout = null | |
+ hideConfirmQuitMsg() | |
+ }, 1000) | |
+ return | |
+ } | |
+ clearTimeout(quitDoubleTapTimeout) | |
+ quitDoubleTapTimeout = null | |
+ hideConfirmQuitMsg() | |
+ } | |
return ipc.sendChannel('command', 'application:quit'); | |
}); | |
this.command('application:hide', function() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Has this been deployed?