Global RButton Actions
- Right Click + Wheel Up/Down => Move to Left/Right Tab
- Right Click + Left Click => Close tab
- Right Click down and move mouse left/right => Switch Desktops
If any of above action triggers, do not show native right-click context menu
This is the closest I have been, but it always shows context menu once RButton is released.
Code: Select all
RButton::RButton ; needed to keep normal function of right click
RButton & LButton:: SendInput, ^{w}
RButton & WheelUp:: SendInput, ^+{Tab}
RButton & WheelDown:: SendInput, ^{Tab}
~RButton::
xValue := 0
yValue := 0
MouseGetPos, x, y
While GetKeyState("RButton", "P")
{
MouseGetPos, new_x, new_y
xValue := x - new_x
yValue := y - new_y
if(xValue != 0 & yValue != 0)
{
if(xValue > 60 && xValue >= yValue && (yValue > -20 && yValue < 20))
{
SendInput, ^#{Left}
sleep 150
xValue := 0
yValue := 0
MouseGetPos, x, y
continue
}
else if(xValue < -60 && xValue <= yValue && (yValue > -20 && yValue < 20))
{
SendInput, ^#{Right}
sleep 150
xValue := 0
yValue := 0
MouseGetPos, x, y
continue
}
}
}
return
Code: Select all
#if GetKeyState("RButton", "P")
isFired := false
RButton::RButton ; needed to keep normal function of right click
RButton & LButton::
SendInput, ^{w}
isFired := true
return
RButton & WheelUp::
SendInput, ^+{Tab}
isFired := true
return
RButton & WheelDown::
SendInput, ^{Tab}
isFired := true
return
~RButton::
xValue := 0
yValue := 0
MouseGetPos, x, y
While GetKeyState("RButton", "P")
{
MouseGetPos, new_x, new_y
xValue := x - new_x
yValue := y - new_y
if(xValue != 0 & yValue != 0)
{
if(xValue > 60 && xValue >= yValue && (yValue > -20 && yValue < 20))
{
SendInput, ^#{Left}
isFired := true
sleep 150
xValue := 0
yValue := 0
MouseGetPos, x, y
continue
}
else if(xValue < -60 && xValue <= yValue && (yValue > -20 && yValue < 20))
{
SendInput, ^#{Right}
isFired := true
sleep 150
xValue := 0
yValue := 0
MouseGetPos, x, y
continue
}
}
}
if(!isFired) {
; somehow, suppress right-click context menu
}
return
#if
Thanks in advance for the help & reading this question.