Switch to the Left Tab or Right Tab using keyboard shortcuts:
For Firefox 100+ (more precisely from Firefox Quantum, realeased in 2017, when the keyboard shortcuts remapping add-ons stopped working )
you can switch to the next tab or previous tab using an extension that gives you mouse gestures and use Autohotkey to control the mouse gestures by pressing a key on the keyboard.
For example you can install the add-on:
Gesturefy
https://addons.mozilla.org/en-US/firefox/addon/gesturefy/
or
Foxy Gestures
https://addons.mozilla.org/en-US/firefox/addon/foxy-gestures/
and set them up to
- switch to the right tab when holding the right mouse button and dragging to the right,
- switch to the left tab when holding the right mouse button and dragging to the left,
Then install Autohotkey and add the following code to the Autohotkey.ahk startup script file:
;firefox
#IfWinActive, ahk_exe firefox.exe
;; use key for mouse gesture - Navigate to the Right Tab
f4::
;; use the function - show_Mouse(bShow := True)
show_Mouse(False)
;; Click and drag Right - Relative to the current mouse position
;; MouseClickDrag right, start X pos = 0, start Y pos = 0, End X pos = 20 (i.e. to the right), End Y pos 0, Speed = 0 - i.e : in the range: 0 (fastest) to 100 (slowest) , R = relative
MouseClickDrag right, 0, 0, 20, 0, 0, R
;;
;;
;; alternative to MouseClickDrag, using SendEvent:
;;SendEvent "{Click 0 0 Down Right Relative}{click 20 0 Up Right Relative}"
;; move back mouse (to the Left) to the original position
MouseMove, -20, 0, 0, R
show_Mouse(True)
Return
;; use key for mouse gesture - Navigate to the Left Tab
f3::
;; use the function - show_Mouse(bShow := True)
show_Mouse(False)
;; Click and drag Left - Relative to the current mouse position
;; MouseClickDrag right, start X pos = 0, start Y pos = 0, End X pos = -20 (i.e. to the left), End Y pos 0, Speed = 0 - i.e : in the range: 0 (fastest) to 100 (slowest) , R = relative
MouseClickDrag right, 0, 0, -20, 0, 0, R
;;
;;
;; alternative to MouseClickDrag, using SendEvent:
;;SendEvent "{Click 0 0 Down Left Relative}{click 20 0 Up Left Relative}"
;; move back mouse (to the Right) to the original position
MouseMove, 20, 0, 0, R
show_Mouse(True)
Return
#If ; END for firefox.exe
;; function to hide or show the Mouse pointer
;-------------------------------------------------------------------------------
show_Mouse(bShow := True) { ; show/hide the mouse cursor - source: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=37781
;-------------------------------------------------------------------------------
; WINAPI: SystemParametersInfo, CreateCursor, CopyImage, SetSystemCursor
; https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947.aspx
; https://msdn.microsoft.com/en-us/library/windows/desktop/ms648385.aspx
; https://msdn.microsoft.com/en-us/library/windows/desktop/ms648031.aspx
; https://msdn.microsoft.com/en-us/library/windows/desktop/ms648395.aspx
;---------------------------------------------------------------------------
static BlankCursor
static CursorList := "32512, 32513, 32514, 32515, 32516, 32640, 32641"
. ",32642, 32643, 32644, 32645, 32646, 32648, 32649, 32650, 32651"
local ANDmask, XORmask, CursorHandle
If bShow ; shortcut for showing the mouse cursor
Return, DllCall("SystemParametersInfo"
, "UInt", 0x57 ; UINT uiAction (SPI_SETCURSORS)
, "UInt", 0 ; UINT uiParam
, "Ptr", 0 ; PVOID pvParam
, "UInt", 0 ; UINT fWinIni
, "Cdecl Int") ; return BOOL
If Not BlankCursor { ; create BlankCursor only once
VarSetCapacity(ANDmask, 32 * 4, 0xFF)
VarSetCapacity(XORmask, 32 * 4, 0x00)
BlankCursor := DllCall("CreateCursor"
, "Ptr", 0 ; HINSTANCE hInst
, "Int", 0 ; int xHotSpot
, "Int", 0 ; int yHotSpot
, "Int", 32 ; int nWidth
, "Int", 32 ; int nHeight
, "Ptr", &ANDmask ; const VOID *pvANDPlane
, "Ptr", &XORmask ; const VOID *pvXORPlane
, "Cdecl Ptr") ; return HCURSOR
}
; set all system cursors to blank, each needs a new copy
Loop, Parse, CursorList, `,, %A_Space%
{
CursorHandle := DllCall("CopyImage"
, "Ptr", BlankCursor ; HANDLE hImage
, "UInt", 2 ; UINT uType (IMAGE_CURSOR)
, "Int", 0 ; int cxDesired
, "Int", 0 ; int cyDesired
, "UInt", 0 ; UINT fuFlags
, "Cdecl Ptr") ; return HANDLE
DllCall("SetSystemCursor"
, "Ptr", CursorHandle ; HCURSOR hcur
, "UInt", A_Loopfield ; DWORD id
, "Cdecl Int") ; return BOOL
}
}
The code hides the mouse movement when pressing the keys but you can remove that option (and the show_Mouse() function, too ) and be able to see the mouse moving.
The code means that when you press the F3 key you switch to the Left Tab, and when you press the F4 key you switch to the Right Tab, but the mouse must be inside the page window, not on top of the menu or other buttons, which is easy to do.
Inside Autohotkey, you can use mouse buttons or the scrolling up or down commands instead of keyboard shortcuts.