From b58eb6cb9fe3082a69562c7701ac75eafe1461c7 Mon Sep 17 00:00:00 2001 From: speedie Date: Thu, 20 Apr 2023 19:19:46 +0200 Subject: [PATCH] last commit can now be done with an argument --- docs/docs.md | 6 ++++++ libs/argv.c | 6 ++++++ spmenu.1 | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/docs/docs.md b/docs/docs.md index 42f71f7..32f419f 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -89,6 +89,12 @@ You may use long, descriptive arguments or the shorter arguments. `-nci, --no-color-items` : Don't color items +`-sgr, --sgr` +: Interpret SGR sequences + +`-nsgr, --no-sgr` +: Display SGR sequences as text + `-a, --alpha` : Enable alpha diff --git a/libs/argv.c b/libs/argv.c index c9fe6f6..1619d56 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -165,6 +165,10 @@ readargs(int argc, char *argv[]) coloritems = 1; } else if (!strcmp(argv[i], "-nci") || (!strcmp(argv[i], "--no-color-items"))) { // don't color items coloritems = 0; + } else if (!strcmp(argv[i], "-sgr") || (!strcmp(argv[i], "--sgr"))) { // enable sgr seq support + sgr = 1; + } else if (!strcmp(argv[i], "-nsgr") || (!strcmp(argv[i], "--no-sgr"))) { // disable sgr seq support + sgr = 0; } else if (i + 1 == argc) { // any of the arguments we checked first if ((!strcmp(argv[i], "-xrdb") @@ -426,6 +430,8 @@ usage(void) "spmenu -nip, --no-indent Don't indent items to prompt width\n" "spmenu -ci, --color-items Color items\n" "spmenu -nci, --no-color-items Don't color items\n" + "spmenu -sgr, --sgr Interpret SGR sequences\n" + "spmenu -nsgr, --no-sgr Display SGR sequences as text\n" "spmenu -a, --alpha Enable alpha\n" "spmenu -na, --no-alpha Disable alpha\n" "spmenu -tp, --allow-typing Allow the user to type\n" diff --git a/spmenu.1 b/spmenu.1 index ed5e090..fa4b59c 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -106,6 +106,12 @@ Color items \f[V]-nci, --no-color-items\f[R] Don\[cq]t color items .TP +\f[V]-sgr, --sgr\f[R] +Interpret SGR sequences +.TP +\f[V]-nsgr, --no-sgr\f[R] +Display SGR sequences as text +.TP \f[V]-a, --alpha\f[R] Enable alpha .TP