Add keyboard shortcut for renaming windows

This commit is contained in:
Nick Krichevsky 2015-02-23 08:21:05 -05:00
parent 0379300e1c
commit 5585028fa8

View file

@ -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
}));
}
}
});
});