mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
hinting: allow hints to open in bg
This commit is contained in:
parent
17e42588b0
commit
9e75cbed3f
3 changed files with 25 additions and 6 deletions
|
@ -574,11 +574,12 @@ export async function reset(key: string){
|
|||
// {{{ HINTMODE
|
||||
|
||||
//#background_helper
|
||||
import {hintPageSimple} from './hinting_background'
|
||||
import * as hinting from './hinting_background'
|
||||
|
||||
//#background
|
||||
export function hint() {
|
||||
hintPageSimple()
|
||||
export function hint(option: string) {
|
||||
if (option === '-b') hinting.hintPageOpenInBackground()
|
||||
else hinting.hintPageSimple()
|
||||
mode('hint')
|
||||
}
|
||||
|
||||
|
|
|
@ -252,9 +252,22 @@ select,
|
|||
[tabindex]
|
||||
`
|
||||
|
||||
// DEBUGGING
|
||||
/* hintPage(hintables(), hint=>mouseEvent(hint.target, 'click')) */
|
||||
/* addEventListener('keydown', pushKey) */
|
||||
import browserBg from './lib/browser_proxy'
|
||||
|
||||
function hintPageOpenInBackground() {
|
||||
hintPage(hintables(), hint=>{
|
||||
hint.target.focus()
|
||||
if (hint.target.href && ! hint.target.href.startsWith('#')) {
|
||||
browserBg.tabs.create({
|
||||
active: false,
|
||||
url: hint.target.href
|
||||
})
|
||||
} else {
|
||||
// This is to mirror vimperator behaviour.
|
||||
mouseEvent(hint.target, "click")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hintPageSimple() {
|
||||
console.log("Hinting!")
|
||||
|
@ -277,4 +290,5 @@ addListener('hinting_content', attributeCaller({
|
|||
selectFocusedHint,
|
||||
reset,
|
||||
hintPageSimple,
|
||||
hintPageOpenInBackground,
|
||||
}))
|
||||
|
|
|
@ -16,6 +16,10 @@ export async function hintPageSimple() {
|
|||
return await messageActiveTab('hinting_content', 'hintPageSimple')
|
||||
}
|
||||
|
||||
export async function hintPageOpenInBackground() {
|
||||
return await messageActiveTab('hinting_content', 'hintPageOpenInBackground')
|
||||
}
|
||||
|
||||
import {MsgSafeKeyboardEvent} from './msgsafe'
|
||||
|
||||
/** At some point, this might be turned into a real keyseq parser
|
||||
|
|
Loading…
Add table
Reference in a new issue