watchers: Add a new event on_color_scheme_preference_change

Fixes #8246
This commit is contained in:
Kovid Goyal
2025-01-23 05:36:25 +05:30
parent a754c8280f
commit ea9afc6e89
4 changed files with 26 additions and 3 deletions

View File

@@ -168,6 +168,13 @@ create :file:`~/.config/kitty/mywatcher.py` and use :option:`launch --watcher` =
# data will contain is_start, cmdline and time.
...
def on_color_scheme_preference_change(boss: Boss, window: Window, data: dict[str, Any]) -> None:
# called when the color scheme preference of this window changes from
# light to dark or vice versa. data contains is_dark and via_escape_code
# the latter will be true if the color scheme was changed via escape
# code received from the program running in the window
...
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
that contains event dependent data. You have full access to kitty internals in