The hot corners on Mac are very convenient, but they have been missing on Windows. Recently, I wrote a simple script using AutoHotKey to implement this functionality. It’s worth noting that the resolution of my computer is 2560×1600, so adjustments may be needed based on the actual situation when using it.
Before you start using it, if you don’t know what AutoHotKey is, you can take a look at this page.
Here are the instructions for each hot corner:
- Top left corner: Lock screen
- Top right corner: Close the current window
- Bottom left corner: Open the Start Menu
- Bottom right corner: Open the Notification Center
You can customize the script to change the hot corners or the actions that are performed when they are triggered. For more information, see the AutoHotKey documentation.
Top left corner – Lock screen
CoordMode, mouse, screen
Loop
{
sleep, 3000
If (x=0) && (y=0)
DllCall("LockWorkStation")
MouseGetPos, x, y
If (x=0) && (y=1599)
send #
}
- CoordMode, mouse, screen: Sets the mouse coordinate mode to screen coordinates.
- Loop: Initiates an infinite loop.
- sleep, 3000: Pauses (sleeps) for 3 seconds, waiting for 3 seconds.
- If (x=0) && (y=0) DllCall(“LockWorkStation”): If the current mouse position has x-coordinate 0 and y-coordinate 0, it calls the LockWorkStation function (pressing Win+L to lock the screen).
- MouseGetPos, x, y: Retrieves the current screen coordinates of the mouse and stores them in the variables x and y.
- If (x=0) && (y=1599) send #: If the current mouse position has x-coordinate 0 and y-coordinate 1599, it sends a #(win) key
Top right corner – Close the current window
CoordMode, mouse, screen
Loop
{
sleep, 3000
MouseGetPos, x, y
; Define the screen width and height
screenWidth := A_ScreenWidth
screenHeight := A_ScreenHeight
; Set the top-right corner coordinates
topRightX := screenWidth
topRightY := 0
; Check if the mouse is at the top-right corner
If (x = topRightX) && (y = topRightY)
{
; Add a command to close the current window here
WinClose, A
}
}
Bottom left corner – Windows menu pops up
CoordMode, mouse, screen
Loop
{
Sleep, 3000
MouseGetPos, x, y
; Define the left-bottom corner coordinates
leftBottomX := 0
leftBottomY := A_ScreenHeight - 1
; Check if the mouse is at the left-bottom corner
If (x = leftBottomX) && (y = leftBottomY)
{
; Send the Win key to open the Start Menu
Send, {LWin}
}
}
Bottom right corner – Notification center pops up
CoordMode, mouse, screen
Loop
{
Sleep, 3000
MouseGetPos, x, y
; Define the right-bottom corner coordinates
rightBottomX := A_ScreenWidth - 1
rightBottomY := A_ScreenHeight - 1
; Check if the mouse is at the right-bottom corner
If (x = rightBottomX) && (y = rightBottomY)
{
; Send the Action Center key to open the Notification Center
Send, ^{Win}a
}
}
The above are some simple examples. Once you’ve determined the screen pixels, you can write Windows hot corners according to your needs.