Skip to content

Instantly share code, notes, and snippets.

@lu0
Created August 4, 2022 00:25
Show Gist options
  • Save lu0/6dc1cb094343f7294cf15a303786b06d to your computer and use it in GitHub Desktop.
Save lu0/6dc1cb094343f7294cf15a303786b06d to your computer and use it in GitHub Desktop.
Autohotkey script to switch the cursor between displays
#NoTrayIcon
#SingleInstance Force
CoordMode, Mouse, Screen
; Autohotkey script to move the cursor from the left to the right monitor and viceversa
; Currently hardcoded
LeftMonitorWidth = 1920
LeftMonitorHeight = 1080
RightMonitoWidth = 2560
RightMonitoHeight = 1440
CenterX = 0
CenterY = 0
; 0 is immediate
MouseSpeed = 0
; super + 1
; Move cursor to the left monitor
#1::
LeftMonitorMidX := CenterX - (LeftMonitorWidth/2)
LeftMonitorMidY := CenterY + (LeftMonitorHeight/2)
MouseMove, LeftMonitorMidX, LeftMonitorMidY, MouseSpeed
return
; super + 2
; Move cursor to the right monitor
#2::
RightMonitorMidX := CenterX + (RightMonitorWidth/2)
RightMonitorMidY := CenterY + (RightMonitorHeight/2)
MouseMove, RightMonitorMidX, RightMonitorMidY, MouseSpeed
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment