sites

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

st-colors-at-launch-0.8.4.diff (824B)


      1 From 268d767b16d21f6f936bd5e3dfcd4f0187a8e979 Mon Sep 17 00:00:00 2001
      2 From: MLquest8 <miskuzius@gmail.com>
      3 Date: Sun, 12 Jul 2020 09:47:25 +0400
      4 Subject: [PATCH] allow to alocate colors as launch options. Example: -C
      5  "#color@num"
      6 
      7 ---
      8  x.c | 7 +++++++
      9  1 file changed, 7 insertions(+)
     10 
     11 diff --git a/x.c b/x.c
     12 index 210f184..a07e358 100644
     13 --- a/x.c
     14 +++ b/x.c
     15 @@ -1980,6 +1980,8 @@ usage(void)
     16  int
     17  main(int argc, char *argv[])
     18  {
     19 +    int i;
     20 +    char *colval;
     21  	xw.l = xw.t = 0;
     22  	xw.isfixed = False;
     23  	xsetcursor(cursorshape);
     24 @@ -2024,6 +2026,11 @@ main(int argc, char *argv[])
     25  	case 'v':
     26  		die("%s " VERSION "\n", argv0);
     27  		break;
     28 +    case 'C':
     29 +        colval = strtok(EARGF(usage()), "@");
     30 +        i = atoi(strtok(NULL, "@"));
     31 +		colorname[i] = colval;
     32 +		break;
     33  	default:
     34  		usage();
     35  	} ARGEND;
     36 -- 
     37 2.26.2
     38