Skip to content

Instantly share code, notes, and snippets.

@kbtz
Created March 3, 2025 03:09
Show Gist options
  • Save kbtz/8670c8e023078f8c27d77345ac545a8d to your computer and use it in GitHub Desktop.
Save kbtz/8670c8e023078f8c27d77345ac545a8d to your computer and use it in GitHub Desktop.
;; # RightClick + WheelUp
;; Switch between 2 virtual desktops back and forth
;;
;; # RightClick + WheelDown
;; Triggers Alt+Tab (previous window back and forth)
;; Triggers Alt+Shift+Tab (cycle windows) when scrolling
#Requires AutoHotkey v2.0
global forward := true
global lastUp := 0
global lastDown := 0
debounceUp := 600
debounceDown := 150
cycleWindow := 900
RButton::RButton
RButton & WheelUp:: {
global forward, lastUp, lastDown
now := A_TickCount
if (now - lastDown < cycleWindow) {
Send("!{Tab}")
lastDown := now
return
}
if (now - lastUp < debounceUp)
return
if forward
Send("^#{Right}")
else
Send("^#{Left}")
lastUp := now
forward := !forward
}
RButton & WheelDown:: {
global lastDown
now := A_TickCount
if (now - lastDown < debounceDown)
return
if (now - lastDown < cycleWindow)
Send("!+{Tab}")
else
Send("!{Tab}")
lastDown := now
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment