Noitidart / MouseControl

ff-addon: Enables user-defined "natural mouse combinations" to trigger customizable functions.
https://addons.mozilla.org/en-US/firefox/addon/mousecontrol/?src=github
14 stars 2 forks source link

Suggestion on new mouse actions #12

Closed BrontoRed closed 7 years ago

BrontoRed commented 7 years ago

Would be great to add such actions as "Close tabs to the right" (right mouse button down + tilting mouse wheel to the right), "Close tabs to the left" (right mouse button down + tilting mouse wheel to the left), "Close other tabs" (3x clicking right mouse button).

Noitidart commented 7 years ago

Hey there, MouseControl is designed so you can do set up whatever you like. The code to close tabs to the right is this:

Close all Tabs to Right

{
    __exec__() {
        var win = Services.wm.getMostRecentWindow('navigator:browser');
        if (!win) return;
        var gbrowser = win.gBrowser;
        var targettabs = [];
        var tabs = gbrowser.visibleTabs;
        var foundself = false;
        var selftab = gbrowser.selectedTab;
        for (var tab of tabs) {
            if (foundself && !tab.pinned) gbrowser.removeTab(tab, { animated:true })
            if (tab == selftab) foundself = true;
        }
    }
}

I'll take a screencast for you.

Noitidart commented 7 years ago

Here's the screencast - Youtube :: MouseControl - Install Custom Command

BrontoRed commented 7 years ago

Wow, thanks! I'm not a programmer and can't write my own code for different actions. I think, that users like me would appreciate if there would be some kind of repository with additional actions (something like "Code" - "Action"). P.s. 1. Screencast returns "Non-Image content-type returned". Nothing there.

  1. "Close All Other Tabs" set to "3x clicking right mouse button" interfere with "Open a new tab" set to "2x clicking right mouse button"
Noitidart commented 7 years ago

Oops here's the fixed screencast - https://www.youtube.com/watch?v=bi5ARPmKDXk

That's a good idea I created this wiki page and linked to it from the main listing page here -

I want to make a built in browsing system in the addon. But first I need to work on getting this back to AMO so people don't have to come to github to download it :)

Noitidart commented 7 years ago

I'll put up a sign saying if they are not a programmer they can come here and request the scirpt and I can help them write it :) If you have any other requests please let me know :)

BrontoRed commented 7 years ago

Hey, you're fast! Enough commands for me. Thank you! Just consider the issue with actions set to triple and double clicking of RMB.

Noitidart commented 7 years ago

Ohh I see that 2x click intereferes with 3x click. This is something I we can workd around by not baking the first thing 2x but itsead a 2x + wait. The wait waits to see if another click comes in, if it doesnt then it does that action. I'll implement that wait feature :)

BrontoRed commented 7 years ago

Thanks. This topic can be closed.