mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Add tabnextmru bound to ctrl+7
This commit is contained in:
parent
d30d6d9df4
commit
5fa0590529
|
|
@ -2627,6 +2627,20 @@ export async function tabprev(increment = 1) {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the previously used tab, ignoring any tabs used within the last 10 seconds. Handy for flicking through previous tabs.
|
||||
*/
|
||||
//#background
|
||||
export async function tabnextmru() {
|
||||
return browser.tabs.query({ currentWindow: true, hidden: false }).then(tabs => {
|
||||
tabs.sort((a, b) => b.lastAccessed - a.lastAccessed)
|
||||
console.log(tabs)
|
||||
const mru_ish = tabs.findIndex(t => Date.now() - t.lastAccessed - 10000 > 0)
|
||||
console.log(mru_ish)
|
||||
return browser.tabs.update(tabs[(mru_ish > -1 ? mru_ish : 1)].id, { active: true })
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the current tab to another window. Only works for windows of the same type
|
||||
* (can't push a non-private tab to a private window or a private tab to
|
||||
|
|
|
|||
|
|
@ -428,6 +428,7 @@ export class default_config {
|
|||
browsermaps = {
|
||||
"<C-,>": "escapehatch",
|
||||
"<C-6>": "tab #",
|
||||
"<C-7>": "tabnextmru",
|
||||
// "<CS-6>": "tab #", // banned by e2e tests
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@
|
|||
}
|
||||
},
|
||||
"command_4": {
|
||||
"suggested_key": {
|
||||
"default": "MacCtrl+7",
|
||||
"windows": "Alt+7"
|
||||
},
|
||||
"description": "Internal use. See `:help bind`. Use `:bind --mode=browser` to change - do not change here."
|
||||
},
|
||||
"command_5": {
|
||||
|
|
@ -161,4 +165,4 @@
|
|||
"omnibox": {
|
||||
"keyword": "tri"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue