From 26882b77e5bff62e2feac68a14bc2e5547bb5bb3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Aug 2026 22:10:05 +0530 Subject: [PATCH] Add tab change demo --- kitty/shaders/custom/demo.py | 16 ++++++++++++++-- .../{tab-focus.pipeline => tab-change.pipeline} | 2 +- .../custom/{tab-focus.slang => tab-change.slang} | 0 3 files changed, 15 insertions(+), 3 deletions(-) rename kitty/shaders/custom/{tab-focus.pipeline => tab-change.pipeline} (84%) rename kitty/shaders/custom/{tab-focus.slang => tab-change.slang} (100%) diff --git a/kitty/shaders/custom/demo.py b/kitty/shaders/custom/demo.py index d8c67f8c7..224feb225 100644 --- a/kitty/shaders/custom/demo.py +++ b/kitty/shaders/custom/demo.py @@ -293,6 +293,13 @@ def window_focus(window_id: str, geometry: tuple[int, int, int, int]) -> None: remote_control('focus-window', '-m', 'id:1') +def tab_change(window_id: str, geometry: tuple[int, int, int, int]) -> None: + time.sleep(0.2) + remote_control('focus-tab', '-m', 'id:2') + time.sleep(1.5) + remote_control('focus-tab', '-m', 'id:1') + + metadata: dict[str, dict[str, Any]] = { # Background 'inside-the-matrix': {'category': 'background', 'tagline': 'See the bones of reality.'}, @@ -309,9 +316,14 @@ metadata: dict[str, dict[str, Any]] = { 'animate': window_focus, 'category': 'navigation', 'tagline': 'Highlight the active window on focus change.', - 'duration': 3, 'session': 'launch kitten run-shell ls -l\nlaunch kitten run-shell bat -P setup.py\nlaunch kitten run-shell echo Hello World', }, + 'tab-change': { + 'animate': tab_change, + 'category': 'navigation', + 'tagline': 'Highlight the active window on focus change.', + 'session': 'new_tab My Shell\nlaunch kitten run-shell ls\nnew_tab My Code\nlaunch nvim -R {self}', + }, } @@ -436,7 +448,7 @@ def do_one(which: str) -> None: cmd = m.get('cmd', ['nvim', '-R', '+1', self]) os.makedirs(destdir, exist_ok=True) os.environ.pop('KITTY_PUBLIC_KEY', None) - session = m.get('session', '') + session = m.get('session', '').format(self=self) with tempfile.NamedTemporaryFile(mode='w', suffix='.conf', delete=False, prefix='sway-demo-') as f: f.write(SWAY_CONFIG) diff --git a/kitty/shaders/custom/tab-focus.pipeline b/kitty/shaders/custom/tab-change.pipeline similarity index 84% rename from kitty/shaders/custom/tab-focus.pipeline rename to kitty/shaders/custom/tab-change.pipeline index d4ee17049..736433792 100644 --- a/kitty/shaders/custom/tab-focus.pipeline +++ b/kitty/shaders/custom/tab-change.pipeline @@ -3,5 +3,5 @@ startgroup animation_stop 600 animation_curve ease-out animation_step 16 - shaders tab-focus + shaders tab-change endgroup diff --git a/kitty/shaders/custom/tab-focus.slang b/kitty/shaders/custom/tab-change.slang similarity index 100% rename from kitty/shaders/custom/tab-focus.slang rename to kitty/shaders/custom/tab-change.slang