Implement on_quit event for global watchers

Fixes #9682
This commit is contained in:
copilot-swe-agent[bot]
2026-03-17 02:32:06 +00:00
committed by Kovid Goyal
parent 02a34ecd04
commit 25f97f4ce5
4 changed files with 45 additions and 2 deletions

View File

@@ -185,6 +185,14 @@ create :file:`~/.config/kitty/mywatcher.py` and use :option:`launch --watcher` =
# managing all tabs in a single OS Window.
...
def on_quit(boss: Boss, window: Window, data: dict[str, Any]) -> None:
# called when kitty is about to quit. This is called in *global watchers*
# only. It is called twice: once before the quit confirmation dialog is
# shown (data['confirmed'] will be False) and once after the user has
# confirmed quitting (data['confirmed'] will be True). Setting
# data['aborted'] to True will abort the quit in both cases.
...
Every callback is passed a reference to the global ``Boss`` object as well as
the ``Window`` object the action is occurring on. The ``data`` object is a dict