diff --git a/docs/example.Xresources b/docs/example.Xresources index e04281d..fe5acbd 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -83,7 +83,6 @@ spmenu.alpha_caretfgbg: 200 spmenu.alpha_modefg: 255 spmenu.alpha_modebg: 200 - !! Powerline spmenu.powerlineprompt: 1 spmenu.powerlinecount: 1 @@ -135,6 +134,7 @@ spmenu.fast: 0 spmenu.managed: 0 spmenu.mon: -1 spmenu.coloritems: 1 +spmenu.sgr: 1 !! Image spmenu.imagewidth: 200 diff --git a/docs/spmenu.conf b/docs/spmenu.conf index 3a8b140..c3e3421 100644 --- a/docs/spmenu.conf +++ b/docs/spmenu.conf @@ -83,6 +83,7 @@ spmenu = sgr14 = "#00ffff"; sgr15 = "#ffffff"; coloritems = 1; + sgr = 1; } ); // Alpha options diff --git a/libs/conf/config.c b/libs/conf/config.c index 760244c..e2cd00a 100644 --- a/libs/conf/config.c +++ b/libs/conf/config.c @@ -367,6 +367,7 @@ conf_init(void) // coloritems int config_setting_lookup_int(conf, "coloritems", &coloritems); + config_setting_lookup_int(conf, "sgr", &sgr); } } diff --git a/libs/draw.c b/libs/draw.c index 6daca93..70252ae 100644 --- a/libs/draw.c +++ b/libs/draw.c @@ -73,7 +73,7 @@ drawitemtext(struct item *item, int x, int y, int w) for (wr = 0, rd = 0; item->text[rd]; rd++) { if (item->text[rd] == '' && item->text[rd + 1] == '[') { size_t alen = strspn(item->text + rd + 2, "0123456789;"); - if (item->text[rd + alen + 2] == 'm') { // last character in sequence is always 'm' + if (item->text[rd + alen + 2] == 'm' && sgr) { // last character in sequence is always 'm' buffer[wr] = '\0'; if (!lines) { diff --git a/libs/xresources.h b/libs/xresources.h index f481b75..913619c 100644 --- a/libs/xresources.h +++ b/libs/xresources.h @@ -88,6 +88,7 @@ ResourcePref resources[] = { { "dockproperty", INTEGER, &dockproperty }, { "globalcolors", INTEGER, &globalcolors }, { "coloritems", INTEGER, &coloritems }, + { "sgr", INTEGER, &sgr }, { "menuposition", INTEGER, &menuposition }, { "xpos", INTEGER, &xpos }, { "ypos", INTEGER, &ypos }, diff --git a/options.h b/options.h index 0425223..61d8ec2 100644 --- a/options.h +++ b/options.h @@ -210,4 +210,5 @@ static int pango_password = 0; /* Enable support for pango markup f /* Misc */ static int coloritems = 1; /* Color items or not */ +static int sgr = 1; /* Support SGR sequences or not */ static char *worddelimiters = " "; /* Word delimiters used for keybinds that change words, " " is default. */ diff --git a/themes/dmenu.conf b/themes/dmenu.conf index d3db5de..0c124df 100644 --- a/themes/dmenu.conf +++ b/themes/dmenu.conf @@ -1,7 +1,9 @@ /* spmenu dmenu theme * * This config should match vanilla dmenu as closely as possible. I am unable to tell the difference between the two. It should be noted though that SGR sequences are still displayed, so for this reason I've set them all to white. - * Also note that this config disables .Xresources, you can reenable it below if you want. + * + * Also note that this config disables .Xresources, Pango and SGR sequence support, you can reenable it below if you want. + * For perfect dmenu compatibility, you may want to remap keybindings, making sure all of them work in "any mode". */ spmenu = { @@ -65,6 +67,7 @@ spmenu = { sgr14 = "#bbbbbb"; sgr15 = "#bbbbbb"; coloritems = 1; + sgr = 0; } ); // Alpha options @@ -134,11 +137,10 @@ spmenu = { } ); // Pango - // For perfect dmenu compatibility, you may want to disable pango - pango = ( { item = 1; - highlight = 1; - prompt = 1; - input = 1; + pango = ( { item = 0; + highlight = 0; + prompt = 0; + input = 0; leftarrow = 0; rightarrow = 0; numbers = 0;