feat: kitty images patch applied

This commit is contained in:
2026-04-15 13:46:38 +02:00
parent 688f70add0
commit 67c54ec28b
15 changed files with 10000 additions and 58 deletions

View File

@@ -8,6 +8,13 @@
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2;
/* How to align the content in the window when the size of the terminal
* doesn't perfectly match the size of the window. The values are percentages.
* 50 means center, 0 means flush left/top, 100 means flush right/bottom.
*/
static int anysize_halign = 50;
static int anysize_valign = 50;
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
@@ -23,7 +30,8 @@ char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */
char *vtiden = "\033[?6c";
/* By default, use the same one as kitty. */
char *vtiden = "\033[?62c";
/* Kerning / character bounding-box multipliers */
static float cwscale = 1.0;
@@ -163,6 +171,28 @@ static unsigned int mousebg = 0;
*/
static unsigned int defaultattr = 11;
/*
* Graphics configuration
*/
/// The template for the cache directory.
const char graphics_cache_dir_template[] = "/tmp/st-images-XXXXXX";
/// The max size of a single image file, in bytes.
unsigned graphics_max_single_image_file_size = 20 * 1024 * 1024;
/// The max size of the cache, in bytes.
unsigned graphics_total_file_cache_size = 300 * 1024 * 1024;
/// The max ram size of an image or placement, in bytes.
unsigned graphics_max_single_image_ram_size = 100 * 1024 * 1024;
/// The max total size of all images loaded into RAM.
unsigned graphics_max_total_ram_size = 300 * 1024 * 1024;
/// The max total number of image placements and images.
unsigned graphics_max_total_placements = 4096;
/// The ratio by which limits can be exceeded. This is to reduce the frequency
/// of image removal.
double graphics_excess_tolerance_ratio = 0.05;
/// The minimum delay between redraws caused by animations, in milliseconds.
unsigned graphics_animation_min_delay = 20;
/*
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
* Note that if you want to use ShiftMask with selmasks, set this to an other
@@ -170,12 +200,18 @@ static unsigned int defaultattr = 11;
*/
static uint forcemousemod = ShiftMask;
/* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ TERMMOD, Button3, previewimage, {.s = "feh"} },
{ TERMMOD, Button2, showimageinfo, {}, 1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
@@ -183,10 +219,6 @@ static MouseShortcut mshortcuts[] = {
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
};
/* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
@@ -201,6 +233,10 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ TERMMOD, XK_F1, togglegrdebug, {.i = 0} },
{ TERMMOD, XK_F6, dumpgrstate, {.i = 0} },
{ TERMMOD, XK_F7, unloadimages, {.i = 0} },
{ TERMMOD, XK_F8, toggleimages, {.i = 0} },
};
/*