sites

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

dmenu-symbols-4.9.diff (2047B)


      1 From 6d0751e2eed6bfbed3cab0c87c8cb01e0b066be8 Mon Sep 17 00:00:00 2001
      2 From: aleks <aleks.stier@icloud.com>
      3 Date: Sun, 11 Aug 2019 02:01:11 +0200
      4 Subject: [PATCH] Add settings to define symbols for too many options
      5 
      6 Add the settings *symbol_1* and *symbol_2* to config.def.h. These enable
      7 to define the symbols which are printed in dmenu to indicate that either
      8 the input is too long or there are too many options to be shown in dmenu
      9 in one line.
     10 ---
     11  config.def.h | 2 ++
     12  dmenu.c      | 8 ++++----
     13  2 files changed, 6 insertions(+), 4 deletions(-)
     14 
     15 diff --git a/config.def.h b/config.def.h
     16 index 1edb647..f58a50c 100644
     17 --- a/config.def.h
     18 +++ b/config.def.h
     19 @@ -7,6 +7,8 @@ static const char *fonts[] = {
     20  	"monospace:size=10"
     21  };
     22  static const char *prompt      = NULL;      /* -p  option; prompt to the left of input field */
     23 +static const char *symbol_1 = "<";
     24 +static const char *symbol_2 = ">";
     25  static const char *colors[SchemeLast][2] = {
     26  	/*     fg         bg       */
     27  	[SchemeNorm] = { "#bbbbbb", "#222222" },
     28 diff --git a/dmenu.c b/dmenu.c
     29 index 6b8f51b..ff398a7 100644
     30 --- a/dmenu.c
     31 +++ b/dmenu.c
     32 @@ -79,7 +79,7 @@ calcoffsets(void)
     33  	if (lines > 0)
     34  		n = lines * bh;
     35  	else
     36 -		n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
     37 +		n = mw - (promptw + inputw + TEXTW(symbol_1) + TEXTW(symbol_2));
     38  	/* calculate which items will begin the next page and previous page */
     39  	for (i = 0, next = curr; next; next = next->right)
     40  		if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n)
     41 @@ -165,11 +165,11 @@ drawmenu(void)
     42  		}
     43  		x += w;
     44  		for (item = curr; item != next; item = item->right)
     45 -			x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">")));
     46 +			x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(symbol_2)));
     47  		if (next) {
     48 -			w = TEXTW(">");
     49 +			w = TEXTW(symbol_2);
     50  			drw_setscheme(drw, scheme[SchemeNorm]);
     51 -			drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0);
     52 +			drw_text(drw, mw - w, 0, w, bh, lrpad / 2, symbol_2, 0);
     53  		}
     54  	}
     55  	drw_map(drw, win, 0, 0, mw, mh);
     56 -- 
     57 2.22.0
     58