-1

This would be even more useful than a keyboard shortcut. because you can close windows without activating them. Very natural.

0
Alt & RButton:: 
   MouseGetPos, , , id,
   WinGetClass, class, ahk_id %id%

   ; disable for windows taskbar 
   If class not in Shell_TrayWnd
        WinClose, ahk_id %id%
return

You might not want to accidentally close an important program that you're working on. First, find out the ahkclass of your app from "Window spy" function, from the context menu Autohotkey tray icon. Then simply add the class name at the back.

   ;If class not in Shell_TrayWnd, <insert yourapp classname>

Adapted from, https://autohotkey.com/board/topic/43348-close-window-under-mouse/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.