Вы можете поддерживать фокусированную историю окон в массиве.а затем отсортировать элемент окна по индексу в массиве истории:
var focusedWindowHistoty=[];
chrome.windows.onFocusChanged.addListener(function(window) {
focusedWindowHistoty = focusedWindowHistoty.filter(function(it){
return it != window;
});
focusedWindowHistoty.push(window);
});
chrome.windows.getAll(null, (windows) => {
var sorted=windows.sort(function(a,b){
return getIndex(a)>getIndex(b);
});
})
function getIndex(item){
var foundIndex=-1;
focusedWindowHistoty.forEach(function(it,index){
if(it==item){
foundIndex=index;
}
})
return foundIndex;
}