Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* LBUTTON FUNCTIONS
- * LButton close tab when cursor is on the left edge of screen
- * Windows + LButton on right: Close windows
- * Windows + LButton on top: Minimize current windows
- * Windows + LButton on bottom: Minimize all windows
- * coordmode: https://autohotkey.com/board/topic/129855-getting-exact-mouse-position-on-the-screen/
- * Customize the right and bottom coordinate depend on each screen to make it work.
- */
- ; ================ DECLARE AND INITIAL VARIABLES =================
- h_titlebar := 25 ; height of window title bar
- h_taskbar := 40 ; height of taskbar
- w_winctrls := 140 ; width of the all 3 Windows control button
- w_spacetotray := 200 ; distance from middle taskbar to the system tray
- startbutton := 40 ; width of the start button
- #LButton::
- CoordMode, Mouse, Screen
- MouseGetPos, x, y
- TrayTip, Mouse, Position: %x%:%y%
- if (x >= A_ScreenWidth - 1 && y < A_ScreenHeight - h_taskbar) ; Right edge
- WinClose, a
- else if (y <= 0 and x >= 0 and x < A_ScreenWidth - w_winctrls) ; Top edge
- WinMinimize, a
- else if (x > startbutton && x < A_ScreenWidth / 2 + w_spacetotray && y > A_ScreenHeight - 1 || y == h_taskbar-1) ; Bottom edge
- Send, #m
- return
- ~LButton::
- CoordMode, Mouse, Screen
- MouseGetPos, x, y
- ; TrayTip, mouse pos,%x%:%y%
- if (x >= 0 and x <= 8 && y > h_titlebar && y < A_ScreenHeight - h_taskbar) ; Left edge
- {
- Send, ^w
- IfWinActive, (Untitled) ; For Notepad++, In case the last tab was closed
- WinClose, (Untitled)
- }
- else if (x >= A_ScreenWidth - 1 and y > h_titlebar && y < A_ScreenHeight - h_taskbar) ; Right edge
- TrayTip, Mouse > Border actions, Current mouse position: %x%:%y%`nHold Windows key while click to exit, 1
- else if (y <= 0 and x >= 0 and x < A_ScreenWidth - w_winctrls) ; Top edge
- TrayTip, Mouse > Border actions, Current mouse position: %x%:%y%`nHold Windows key while click to minimize, 1
- else if (x > startbutton && x < A_ScreenWidth / 2 + w_spacetotray && y == A_ScreenHeight - 1 || y == h_taskbar-1) ; Bottom edge
- TrayTip, Mouse > Border actions, Current mouse position: %x%:%y%`nHold Windows key while click to minimize all, 1
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement