diff --git a/index.html b/index.html index e24e8a7..520d278 100644 --- a/index.html +++ b/index.html @@ -113,7 +113,7 @@
  • ALT-a: Focus on next buffer with activity
  • ALT-<: Switch to previous buffer
  • ALT-g: Focus on buffer list filter
  • -
  • Esc: disconnect
  • +
  • Esc-Esc: disconnect (double-tap)
  • arrow keys: history navigation
  • diff --git a/js/glowingbear.js b/js/glowingbear.js index 0401427..a5305ab 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -1080,7 +1080,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', if ($rootScope.connected) { event.preventDefault(); // Chrome requires us to set this or it will not show the dialog - event.returnValue = "You have an active connection to your WeeChat relay. Please disconnect using the button in the top-right corner or by pressing the Escape key."; + event.returnValue = "You have an active connection to your WeeChat relay. Please disconnect using the button in the top-right corner or by double-tapping the Escape key."; } $scope.favico.reset(); }; @@ -1273,10 +1273,14 @@ weechat.directive('inputBar', function() { } } - // Escape -> disconnect + // Double-tap Escape -> disconnect if (code === 27) { $event.preventDefault(); - connection.disconnect(); + if (typeof $scope.lastEscape !== "undefined" && (Date.now() - $scope.lastEscape) <= 500) { + // Double-tap + connection.disconnect(); + } + $scope.lastEscape = Date.now(); return true; }