···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(* Kitty Graphics Protocol Demo - Matching kgp/examples/demo *)
78module K = Kgp
+5
example/tiny_anim.ml
···000001(* Tiny animation test - no chunking needed *)
2(* Uses 20x20 images which are ~1067 bytes base64 (well under 4096) *)
3
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(* Tiny animation test - no chunking needed *)
7(* Uses 20x20 images which are ~1067 bytes base64 (well under 4096) *)
8
+5
lib-cli/kgp_cli.ml
···000001(* Cmdliner Support for Kitty Graphics Protocol *)
23open Cmdliner
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(* Cmdliner Support for Kitty Graphics Protocol *)
78open Cmdliner
+5
lib-cli/kgp_cli.mli
···000001(** Cmdliner Support for Kitty Graphics Protocol
23 This module provides Cmdliner terms for configuring graphics output mode
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Cmdliner Support for Kitty Graphics Protocol
78 This module provides Cmdliner terms for configuring graphics output mode
+5
lib/kgp.ml
···000001(* Type modules *)
2module Format = Kgp_format
3module Transmission = Kgp_transmission
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(* Type modules *)
7module Format = Kgp_format
8module Transmission = Kgp_transmission
+5
lib/kgp.mli
···000001(** Kitty Terminal Graphics Protocol
23 This library implements the Kitty terminal graphics protocol, allowing
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Kitty Terminal Graphics Protocol
78 This library implements the Kitty terminal graphics protocol, allowing
+5
lib/kgp_animation.ml
···000001type t =
2 [ `Set_state of Kgp_animation_state.t * int option
3 | `Set_gap of int * int
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t =
7 [ `Set_state of Kgp_animation_state.t * int option
8 | `Set_gap of int * int
+5
lib/kgp_animation.mli
···000001(** Animation Control
23 Operations for controlling animation playback. The protocol supports
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Animation Control
78 Operations for controlling animation playback. The protocol supports
+5
lib/kgp_animation_state.ml
···000001type t = [ `Stop | `Loading | `Run ]
23let to_int : t -> int = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Stop | `Loading | `Run ]
78let to_int : t -> int = function
+5
lib/kgp_animation_state.mli
···000001(** Animation Playback State
23 Controls the playback state of animated images.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Animation Playback State
78 Controls the playback state of animated images.
···000001(** Kitty Graphics Protocol Commands
23 This module provides functions for building and serializing graphics
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Kitty Graphics Protocol Commands
78 This module provides functions for building and serializing graphics
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = {
7 source_frame : int;
8 dest_frame : int;
+5
lib/kgp_compose.mli
···000001(** Frame Composition
23 Operations for compositing rectangular regions between animation frames.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Frame Composition
78 Operations for compositing rectangular regions between animation frames.
+5
lib/kgp_composition.ml
···000001type t = [ `Alpha_blend | `Overwrite ]
23let to_int : t -> int = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Alpha_blend | `Overwrite ]
78let to_int : t -> int = function
+5
lib/kgp_composition.mli
···000001(** Pixel Composition Mode
23 Controls how pixels are blended when compositing images or animation frames.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Pixel Composition Mode
78 Controls how pixels are blended when compositing images or animation frames.
+5
lib/kgp_compression.ml
···000001type t = [ `None | `Zlib ]
23let to_char : t -> char option = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `None | `Zlib ]
78let to_char : t -> char option = function
+5
lib/kgp_compression.mli
···000001(** Data Compression
23 Specifies compression applied to image data before transmission.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Data Compression
78 Specifies compression applied to image data before transmission.
+5
lib/kgp_cursor.ml
···000001type t = [ `Move | `Static ]
23let to_int : t -> int = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Move | `Static ]
78let to_int : t -> int = function
+5
lib/kgp_cursor.mli
···000001(** Cursor Movement Behavior
23 Controls cursor position after displaying an image.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Cursor Movement Behavior
78 Controls cursor position after displaying an image.
+5
lib/kgp_delete.ml
···000001type t =
2 [ `All_visible
3 | `By_id of int * int option
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t =
7 [ `All_visible
8 | `By_id of int * int option
+5
lib/kgp_delete.mli
···000001(** Image Deletion Target
23 Specifies which images or placements to delete.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Image Deletion Target
78 Specifies which images or placements to delete.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Kitty Graphics Protocol Detection
78 Detect terminal graphics support capabilities. *)
+5
lib/kgp_format.ml
···000001type t = [ `Rgba32 | `Rgb24 | `Png ]
23let to_int : t -> int = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Rgba32 | `Rgb24 | `Png ]
78let to_int : t -> int = function
+5
lib/kgp_format.mli
···000001(** Image Data Format
23 Specifies the pixel format of image data being transmitted to the terminal.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Image Data Format
78 Specifies the pixel format of image data being transmitted to the terminal.
+5
lib/kgp_frame.ml
···000001type t = {
2 x : int option;
3 y : int option;
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = {
7 x : int option;
8 y : int option;
+5
lib/kgp_frame.mli
···000001(** Animation Frame Configuration
23 Configuration for adding or editing animation frames. Frames can be
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Animation Frame Configuration
78 Configuration for adding or editing animation frames. Frames can be
+5
lib/kgp_placement.ml
···000001type t = {
2 source_x : int option;
3 source_y : int option;
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = {
7 source_x : int option;
8 source_y : int option;
+5
lib/kgp_placement.mli
···000001(** Image Placement Configuration
23 Configuration for where and how to display images. Placements control
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Image Placement Configuration
78 Configuration for where and how to display images. Placements control
+5
lib/kgp_quiet.ml
···000001type t = [ `Noisy | `Errors_only | `Silent ]
23let to_int : t -> int = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Noisy | `Errors_only | `Silent ]
78let to_int : t -> int = function
+5
lib/kgp_quiet.mli
···000001(** Response Suppression Level
23 Controls which terminal responses are sent back to the application.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Response Suppression Level
78 Controls which terminal responses are sent back to the application.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(* Tmux Passthrough Support - Implementation *)
78let is_active () =
+5
lib/kgp_tmux.mli
···000001(** Tmux Passthrough Support
23 Support for passing graphics protocol escape sequences through tmux
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Tmux Passthrough Support
78 Support for passing graphics protocol escape sequences through tmux
+5
lib/kgp_transmission.ml
···000001type t = [ `Direct | `File | `Tempfile ]
23let to_char : t -> char = function
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6type t = [ `Direct | `File | `Tempfile ]
78let to_char : t -> char = function
+5
lib/kgp_transmission.mli
···000001(** Data Transmission Method
23 Specifies how image data is transmitted to the terminal.
···1+(*---------------------------------------------------------------------------
2+ Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3+ SPDX-License-Identifier: ISC
4+ ---------------------------------------------------------------------------*)
5+6(** Data Transmission Method
78 Specifies how image data is transmitted to the terminal.