From 1ba1698703ed3ff87bb10a62dcaca32d75db9db7 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Thu, 13 Oct 2016 14:16:24 +0200 Subject: [PATCH 1/3] Implement alt-h. Fixes #832 --- index.html | 1 + js/inputbar.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/index.html b/index.html index 62e0616..caceef5 100644 --- a/index.html +++ b/index.html @@ -151,6 +151,7 @@
  • ALT-a: Focus on next buffer with activity
  • ALT-<: Switch to previous active buffer
  • ALT-g: Focus on buffer list filter
  • +
  • ALT-h: Clear unread counters in every buffer (locally)
  • Esc-Esc: Disconnect (double-tap)
  • Arrow keys: Navigate history, or navigate quick search buffer results.
  • Tab: Complete nick
  • diff --git a/js/inputbar.js b/js/inputbar.js index a4fc48b..43839d0 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -357,6 +357,15 @@ weechat.directive('inputBar', function() { return true; } + // Alt-h -> Toggle all as read + if ($event.altKey && !$event.ctrlKey && key === "KeyH" ) { + var buffers = models.getBuffers(); + _.each(buffers, function(buffer) { + buffer.unread = 0; + buffer.notification = 0; + }); + } + var caretPos; // Arrow up -> go up in history From 71c29002166c03606ae1fc2a8f478366d474465e Mon Sep 17 00:00:00 2001 From: Simon Cooksey Date: Wed, 9 Nov 2016 10:32:12 +0000 Subject: [PATCH 2/3] Alt-H now clears hotlists on WeeChat relay Fixes #832. --- js/connection.js | 5 +++++ js/inputbar.js | 1 + 2 files changed, 6 insertions(+) diff --git a/js/connection.js b/js/connection.js index 4c74347..f5f03b5 100644 --- a/js/connection.js +++ b/js/connection.js @@ -420,6 +420,10 @@ weechat.factory('connection', } }; + var sendHotlistClearAll = function() { + sendMessage("/input hotlist_clear"); + }; + var requestNicklist = function(bufferId, callback) { // Prevent requesting nicklist for all buffers if bufferId is invalid if (!bufferId) { @@ -513,6 +517,7 @@ weechat.factory('connection', sendMessage: sendMessage, sendCoreCommand: sendCoreCommand, sendHotlistClear: sendHotlistClear, + sendHotlistClearAll: sendHotlistClearAll, fetchMoreLines: fetchMoreLines, requestNicklist: requestNicklist, attemptReconnect: attemptReconnect diff --git a/js/inputbar.js b/js/inputbar.js index 43839d0..81630ed 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -364,6 +364,7 @@ weechat.directive('inputBar', function() { buffer.unread = 0; buffer.notification = 0; }); + connection.sendHotlistClearAll(); } var caretPos; From 401e46e599c8a1b843e956af422ead36aec92dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Wed, 9 Nov 2016 13:02:21 +0100 Subject: [PATCH 3/3] Use event.keyCode for consistency We should either switch everything to event.code or nothing, imho --- js/inputbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/inputbar.js b/js/inputbar.js index 81630ed..4777988 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -358,7 +358,7 @@ weechat.directive('inputBar', function() { } // Alt-h -> Toggle all as read - if ($event.altKey && !$event.ctrlKey && key === "KeyH" ) { + if ($event.altKey && !$event.ctrlKey && code === 72) { var buffers = models.getBuffers(); _.each(buffers, function(buffer) { buffer.unread = 0;