Commit graph

36 commits

Author SHA1 Message Date
Kovid Goyal
fe5ac530e5
Custom shaders: Add screen-shake shaders for the bell
Shake only the window in which a bell occurred, using
d.bell_window_geometry, either side to side or in random directions.
Useful for shaking the window when a shell command fails. Add docs with
shell snippets to ring the bell on command failure and demo entries.
2026-11-05 14:32:45 +05:30
Kovid Goyal
8a3dace409
Custom shaders: Make bell-in-window event independent of visual bell
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Fire the event directly from screen_bell() instead of piggy-backing on
start_visual_bell_at in the render loop. Previously the event only fired
when visual_bell_duration was non-zero and bells in windows that were not
visible fired it late, when the window was next rendered. Now only bells
in visible windows (in the active tab and not hidden by an overlay or the
layout) fire the event.
2026-11-05 12:26:06 +05:30
Kovid Goyal
bc9d0b87e3
Custom shaders: Add command and alternate screen events and uniforms
Add the command-start, command-finish, alternate-screen-enter and
alternate-screen-exit events, which fire for changes in the active window,
and the active_window_command_running, active_window_alternate_screen,
active_window_command_state_age and active_window_alternate_screen_age
fields to KittyCustomShaderData, so shaders can show effects while
commands run and hide them in full screen programs.
2026-11-05 08:43:37 +05:30
Zhizhen He
1e273aa289 Docs: Correct protocol references, examples and generated help 2026-10-28 13:24:43 +08:00
Kovid Goyal
f9b57ba283
Allow trailing comments in shader pipeline files\n\nFixes #10718
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-10-22 15:50:55 +05:30
Kovid Goyal
bcc6627322
Custom shaders: Add animation_duration, animation_reverse and animation_loops
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
animation_duration sets how long animation_progress takes to rise to one,
after which it stays there, so effects can fade in and stay on. Previously
groups with no stop duration, such as toggled ones, always had a progress
of zero.

animation_reverse makes a group play its animation in reverse when it stops,
for any reason, instead of turning off immediately. With yes it takes as
long as animation_duration, or a number of milliseconds can be given.
Stopping part way through rising reverses from the current progress and
starting again while reversing rises from there.

animation_loops, used with animation_reverse, plays the animation forwards
and in reverse again after the first reverse, without holding at one, for
effects such as blinking a few times.

Also fix attached groups not having the same animation_progress as the group
they are attached to, as documented, and explain why the per-group values
are in KittyTextures rather than KittyCustomShaderData.

Fixes #10693
2026-10-19 07:57:46 +05:30
Kovid Goyal
a2b7721bfb
Fix #10694 2026-10-18 21:03:47 +05:30
Kovid Goyal
7dbfb0e1ce
Custom shaders: Use pointer_map() of groups turned on and off by events
Groups that are active until an event turns them off, such as those
using animation_toggle, now also move pointer events, while they are
active. The pointer map is recomputed only when the set of active such
groups changes, and pointer events are left alone once all of them have
been turned off.
2026-10-15 21:27:18 +05:30
Kovid Goyal
28aad4345e
Custom shaders: Allow controlling shaders with key presses
Add a shader_event action that sends user:<name> events to the custom
shader pipeline, and an animation_toggle pipeline directive to turn
groups on and off with an event. User events occupy the bits above the
builtin events in a now 64 bit event mask, so firing them costs no more
than any other event and groups that are off are not drawn at all.

Fixes #10667
2026-10-15 20:56:31 +05:30
Kovid Goyal
be4fef614b
Custom shaders: Query shader source with a parser instead of regexes
Add a small Slang lexer and top level declaration parser to slang.py, and
SlangShaderQuery which runs the slangc preprocessor when an answer could
depend on it. Use it for:

- Detecting pointer_map(), so that comments, #if 0 blocks and calls no
  longer count, macros are honored, and a pointer_map() that is not public
  or does not return float2 is reported instead of failing obscurely. The
  result is cached alongside the pipeline module, so a cached load does
  not run slangc.
- Applying pipeline var directives, which now work for declarations
  spanning multiple lines and match by name as documented.
- Parsing the builtin shaders, with identical results for all of them.

Also cleanup minor issues form previous PR

- Ignore pointer_map() in groups that only draw to part of the screen
- Share the pointer position conversion between glfw.c and mouse.c
- Pass POINTER_MAP_SIZE to the pipeline as a define instead of
  duplicating it
- Do not free the pointer map render target on every pipeline reload
- Document what pointer_map() may depend on and when d.mouse_pos lines
  up with the pointer
2026-10-10 11:04:08 +05:30
Iurii Lunev
30e07a5b09 Custom shaders: Allow shaders that move content to remap pointer events
A shader that draws content away from where kitty put it, such as crt
curving the screen, makes clicks and selections land on the wrong cells,
since kitty maps the pointer to the unmodified cell grid. Up to several
columns near the edges with the bundled crt shader.

Shaders can now define pointer_map(pos, d), returning where the content
shown at pos actually is. kitty renders it into a 64x64 grid when the
pipeline or viewport size changes, reads it back once, and uses it to
move all pointer events. Only always active groups that draw to the
screen are used, since only they move content permanently.

The crt shader defines it, sharing its warp function with fragment_main().
2026-10-09 23:31:29 +03:00
Kovid Goyal
79c2efd8ce
Particle effects for cursor trail shaders
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Fixes #10587
2026-10-02 10:05:57 +05:30
Kovid Goyal
d7cd5a18c2
Cleanup previous PR on motion blur
Move it into a separate shader
2026-09-26 12:36:01 +05:30
Jonathan Lippincott
6c4170a682 Add cursor trail motion blur custom shader 2026-09-25 16:04:55 +02:00
Kovid Goyal
8e80e96c64
Custom shaders: Include border and margin in active_window_padding
active_window_padding only counted padding and cell-size compensation,
so the space a layout reserves for the window border (and margin) was
treated as outside the active window. With dim-inactive-windows this
left a thin dimmed strip around the active window and dimmed the active
border color.

Use render_data.geometry.spaces, which is exactly what the layout
reserved around the window. This respects layouts that do not reserve
border space in minimal border mode, so the active area never extends
into a neighboring window. Add a test that the reserved boxes of
visible windows never overlap and stay within the central area.
2026-09-24 19:44:10 +05:30
白鸽
1c40a44f0c Custom shaders: Include window title bars in active padding bounds 2026-09-22 16:15:18 +08:00
Kovid Goyal
5d58f2f4cc
cleanup docs for previous PR 2026-09-16 11:48:38 +05:30
白鸽
7b41e33399 Custom shaders: Redraw static effects only on demand 2026-09-14 22:41:26 +08:00
白鸽
cf33820973 Custom shaders: Support tinting complete inactive windows 2026-09-14 22:41:26 +08:00
Kovid Goyal
d124d4f097
Proper fix for custom shader scaling on OS window grow + shrink
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-09-06 14:58:18 +05:30
Kovid Goyal
a782e3736b
Add an attach directive for pipeline groups 2026-08-11 08:47:13 +05:30
Kovid Goyal
953ac19e77
Autoformat slang code 2026-08-10 22:29:18 +05:30
Kovid Goyal
e1f2d2dc8d
A simple shader pipeline example 2026-08-10 20:49:36 +05:30
Kovid Goyal
69c0841765
Add retro terminal shaders to demo gallery 2026-08-10 19:54:49 +05:30
Kovid Goyal
ac2c1ca86c
Pass geometry of window with bell to custom shaders 2026-08-10 13:09:37 +05:30
Kovid Goyal
4a7b87a4f5
Remove extern from custom shader vars declarations
Since we specialize and compiler shader separately for every occurrence
in the pipeline, it is no longer needed.
2026-08-10 12:03:56 +05:30
Kovid Goyal
79a1ad2b57
Cleanup docs 2026-08-10 10:28:21 +05:30
Kovid Goyal
60ab484dfb
Add a focus highlight demo 2026-08-09 21:59:38 +05:30
Kovid Goyal
919523f31a
Link to code for shipped custom shaders 2026-08-09 21:36:39 +05:30
Kovid Goyal
7da676b061
Finish custom shader docs 2026-08-09 20:20:51 +05:30
Kovid Goyal
3b6c330278
Work on documentation for custom shaders 2026-08-09 20:02:47 +05:30
Kovid Goyal
356e140d92
... 2026-08-09 18:47:46 +05:30
Kovid Goyal
c9fef78103
Cleanup docs formatting 2026-08-09 18:42:08 +05:30
Kovid Goyal
802ef3c1ea
Cleanup video demo generation 2026-08-09 16:03:37 +05:30
Kovid Goyal
d97bdc22c9
Define custom shader categories 2026-08-09 13:53:13 +05:30
Kovid Goyal
9e9087c319
Start work on custom shader docs 2026-08-09 13:25:13 +05:30