AHK Script to Clean Up Dead PuTTY Sessions

I have a love-hate relationship with tabbed interfaces. On one hand, they keep my taskbar clean. On the other, they merely scuttle my window-hoarding behaviors into a single window, where the mess grows into a pile of outdated, unused tab sessions (i.e., Firefox). I also have need for some types of programs to be opened in separate windows on a regular basis, such as SSH sessions, where I often work on multiple related tasks which have to be monitored simultaneously. In those instances, the number of PuTTY sessions I have open (and have disconnected) can quickly grow out of control, clogging my taskbar.

PuTTY Fatal Error

Here's a quick script I wrote to clean up any inactive/disconnected PuTTY windows: Cleanup PuTTY Windows

Muchtall Window Arranger (Save Window Positions and Size)

Over the years, I've noticed that there's one "drawback" to multiple heads/screens on a laptop workstation. I get in the habit of arranging my workspace how I like it, where eventually I have 8-10 windows in positions I would prefer to be permanent whenever I hook up my external 2 heads. When I undock, of course everything collapses back to my main display. When I re-dock, the windows remain in a cluttered pile on my main screen. In addition to this, changes in resolution can result in windows needing to be re-sized as well.

I've found one or two utilities over the years that have allowed me to save window positions and sizes, but nothing that handled it for me as automatically as I would have liked. So I wrote my own in AutoHotKey: the Muchtall Window Arranger.

It's fairly simple, yet powerful if you want it to be. Since it's written in AutoHotKey, you can write custom filters to apply to your window rules (assuming you know AHK). But, for the casual user, it simply grabs the active window information and allows you to alter the conditions that apply to the window matching before saving those settings.

Downloadfrom GitHub: Muchtall Window Arranger
You must have AutoHotKey installed before using this script.

There's one setting in the source you'll probably want to modify before you get started. The variable "NumberOfScreens = 3" should be changed to the number of heads you want to have activate the auto-rearrange feature. If this is set to something higher than you'd ever have installed (say 10), the auto-rearrange feature should never activate. Since version 20200817, you no longer need to specify the number of screens. Instead, the script automatically detects the current screen layout, and generates separate profiles for them!

Screenshots:
Task Tray Menu
ahkmenu

Capture/Save window settings
newwindow

I'll probably clean up the rough edges as I get feedback on it. I know there may be some use for features like re-arranging for multiple head settings, so there's work to be done.

Edit: Moved code to GitHub repo