KeyRoutines
TriggerFreetrigger.window.closed

Run a routine when a window closes on Windows 11

Window closed starts a routine when a matching window is closed. Unlike App quit, it works for a single window, so it can react to a dialog, a document or a call window even while the app stays open.

How it works

  • Describe the window to watch by its app, program, title or class.
  • From the moment it is armed, KeyRoutines remembers the matching windows and their last title, because a closing window can no longer say what it was.
  • It works for top-level windows only, and remembers up to 256 matching windows at a time.
  • The routine receives the window's last title and program; the window itself is already gone by then.

Routines that use it

After a call ends

When your meeting window closes, App volume brings your music back up and Quiet mode turns off.

Clean up after a dialog

When the print dialog closes, Restore layout puts your documents back where they were.

Log finished sessions

When a window with "Remote Desktop" in its title closes, Add text to file writes the time to a log.

Settings

SettingWhat it does
WindowThe window to watch: its app, program, title or class.

Good to know

  • Only top-level windows are watched, not panels or controls inside an app.

Questions

Can I trigger something when a specific window closes, not the whole app?
Yes, that's what Window closed is for. Describe the window by its title or class and the routine runs when that window goes away, even if the app keeps running.
What is the difference between Window closed and App quit?
App quit waits until the whole app has exited. Window closed fires as soon as one matching window is closed.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.