This would be even more useful than a keyboard shortcut. because you can close windows without activating them. Very natural.
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>