sites

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

dmenu-borderoption-20200217-bf60a1e.diff (1469B)


      1 From bf60a1eaf98c7aebae51021914e35bc73dd8c23e Mon Sep 17 00:00:00 2001
      2 From: 0x1bi <ben@0x1bi.net>
      3 Date: Mon, 17 Feb 2020 11:02:35 -0500
      4 Subject: [PATCH] added border with option
      5 
      6 
      7 diff --git a/config.def.h b/config.def.h
      8 index 1edb647..dd3eb31 100644
      9 --- a/config.def.h
     10 +++ b/config.def.h
     11 @@ -21,3 +21,6 @@ static unsigned int lines      = 0;
     12   * for example: " /?\"&[]"
     13   */
     14  static const char worddelimiters[] = " ";
     15 +
     16 +/* Size of the window border */
     17 +static unsigned int border_width = 0;
     18 diff --git a/dmenu.c b/dmenu.c
     19 index 65f25ce..f0c3c6f 100644
     20 --- a/dmenu.c
     21 +++ b/dmenu.c
     22 @@ -659,9 +659,11 @@ setup(void)
     23  	swa.override_redirect = True;
     24  	swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
     25  	swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask;
     26 -	win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
     27 +	win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width,
     28  	                    CopyFromParent, CopyFromParent, CopyFromParent,
     29  	                    CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
     30 +	if (border_width)
     31 +		XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel);
     32  	XSetClassHint(dpy, win, &ch);
     33  
     34  
     35 @@ -733,6 +735,8 @@ main(int argc, char *argv[])
     36  			colors[SchemeSel][ColFg] = argv[++i];
     37  		else if (!strcmp(argv[i], "-w"))   /* embedding window id */
     38  			embed = argv[++i];
     39 +		else if (!strcmp(argv[i], "-bw"))
     40 +			border_width = atoi(argv[++i]); /* border width */
     41  		else
     42  			usage();
     43  
     44 -- 
     45 2.24.1
     46