sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

st-customcursor-20250405-98610fc.diff (1221B)


      1 From 7e301a937ca2c8923e54ba159b387425cf213167 Mon Sep 17 00:00:00 2001
      2 From: Mertoalex Ashley <mertoalex+git@disroot.org>
      3 Date: Sat, 5 Apr 2025 02:23:30 +0300
      4 Subject: [PATCH] adding macro to set set custom cursor for st extension.
      5 
      6 ---
      7  config.def.h | 3 ++-
      8  x.c          | 4 ++++
      9  2 files changed, 6 insertions(+), 1 deletion(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 2cd740a..80dc484 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -139,9 +139,10 @@ static unsigned int defaultrcs = 257;
     16   * 2: Block ("█")
     17   * 4: Underline ("_")
     18   * 6: Bar ("|")
     19 - * 7: Snowman ("☃")
     20 + * 7: Custom block (default: "☃")
     21   */
     22  static unsigned int cursorshape = 2;
     23 +#define CUSTOM_BLOCK 0x2603 /* snowman (U+2603) */
     24  
     25  /*
     26   * Default columns and rows numbers
     27 diff --git a/x.c b/x.c
     28 index d73152b..353635c 100644
     29 --- a/x.c
     30 +++ b/x.c
     31 @@ -1562,7 +1562,11 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
     32  	if (IS_SET(MODE_FOCUSED)) {
     33  		switch (win.cursor) {
     34  		case 7: /* st extension */
     35 +			#ifdef CUSTOM_BLOCK
     36 +			g.u = CUSTOM_BLOCK;
     37 +			#else
     38  			g.u = 0x2603; /* snowman (U+2603) */
     39 +			#endif
     40  			/* FALLTHROUGH */
     41  		case 0: /* Blinking Block */
     42  		case 1: /* Blinking Block (Default) */
     43 -- 
     44 2.48.1
     45