Firefox global mouse gesture by user script and hotkey (Win7/Linux + FF 68 esr )

0

Problem

Mouse gestures in Firefox Quantum is far more limited compared to the flexibility of the legacy add-on FireGuestures. For example mouse gestures are not effective in pages like the "newtab".

One way (maybe the only way) to allow global gesture is to use external programs like StrokeIt/StrokePlus etc.

It is pretty easy to set up the gestures to send hot keys, for example Ctrl+W to close tab. I find that it works well for back/forward and closing tabs.

The only remaining one I want to have is a multi-functional gesture "Down", which depending on the context opens a link or searches the selected text or minimizes the window. In FireGesture it is bind to a user script.

And I'm wondering if it is possible to bind these functions to a hot key to execute the script say in Greasemoney. Then the external gesture program can just send the hot key.

FoxGesture

I have tried closest relative of FireGuestrue - Foxy gesture.

To be honest, it is almost the best you can get within the limitation of webextension API. For example, the Down gesture can be implemented by the following custom user script

let selectedText = window.getSelection().toString();

if (selectedText) {
    // Check if the selection looks like a hyperlink.
    if (/\s*https?:\/\//.test(selectedText)) {
        // Open the link in a new background tab.
        data.element.linkHref = selectedText.trim();
        executeInBackground(data => commandOpenLinkInNewBackgroundTab(data), [ data ]);
    } else {
        // Search for the selected text in a new background tab.
        data.element.linkHref = 'https://encrypted.google.com/search?q=' + encodeURIComponent(selectedText);
        executeInBackground(data => commandOpenLinkInNewBackgroundTab(data), [ data ]);
    }
} else if (data.element.linkHref) {
    // Open the link in a new background tab.
    executeInBackground(data => commandOpenLinkInNewBackgroundTab(data), [ data ]);
} else {
    executeInBackground(() => {
        browser.windows.getCurrent().then(win => {
            browser.windows.update(win.id, { state: 'minimized' });
        })
    })
}

But it can not work along with the external programs, because the external program will capture the gesture first. Without the hotkey, they can not translate the gesture to the user script stored inside FoxyGesture.

So I am wondering if you could suggest add-ons or other workaround to solve this problem.

Thanks.

anecdote

Posted 2019-07-30T03:35:27.840

Reputation: 111

No answers