From 5585028fa872a11a0199416ac00cdf54aa4ff03b Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Mon, 23 Feb 2015 08:21:05 -0500 Subject: [PATCH] Add keyboard shortcut for renaming windows --- popup.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/popup.js b/popup.js index 2e1e305..5211b83 100644 --- a/popup.js +++ b/popup.js @@ -348,7 +348,7 @@ document.addEventListener('DOMContentLoaded', function() { }); window.addEventListener('keydown', function(event){ - var windowList = createWindowList(mainList, windowKeyIndex); + var windowList = createWindowList(mainList); var tabList = createTabList(mainList,windowKeyIndex); //If down is pressed, traverse through tabs. if (event.keyCode===40){ @@ -474,5 +474,17 @@ document.addEventListener('DOMContentLoaded', function() { scrollTo(0, 0); filterInput.focus(); } + //Rename a window when R is pressed + else if (event.keyCode==82){ + event.preventDefault(); + if (tabKeyIndex===-1){ + var windowList = createWindowList(mainList); + windowList[windowKeyIndex].querySelector('span.textContent > span.windowName').dispatchEvent(new MouseEvent('dblclick',{ + 'view':window, + 'bubbles':true, + 'cancellable':true + })); + } + } }); }); \ No newline at end of file