Add keyboard shortcut for renaming windows
This commit is contained in:
parent
0379300e1c
commit
5585028fa8
14
popup.js
14
popup.js
|
@ -348,7 +348,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('keydown', function(event){
|
window.addEventListener('keydown', function(event){
|
||||||
var windowList = createWindowList(mainList, windowKeyIndex);
|
var windowList = createWindowList(mainList);
|
||||||
var tabList = createTabList(mainList,windowKeyIndex);
|
var tabList = createTabList(mainList,windowKeyIndex);
|
||||||
//If down is pressed, traverse through tabs.
|
//If down is pressed, traverse through tabs.
|
||||||
if (event.keyCode===40){
|
if (event.keyCode===40){
|
||||||
|
@ -474,5 +474,17 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
scrollTo(0, 0);
|
scrollTo(0, 0);
|
||||||
filterInput.focus();
|
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
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue