sites

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

tabbed-separator-20230128-41e2b8f.diff (1430B)


      1 From 52368fd4c9b757dc48cfb3662d87c7dc2fe6d1b9 Mon Sep 17 00:00:00 2001
      2 From: Casey Fitzpatrick <kcghost@gmail.com>
      3 Date: Fri, 13 Jan 2023 17:31:08 -0500
      4 Subject: [PATCH] Add configurable separator bar
      5 
      6 ---
      7  config.def.h |  1 +
      8  tabbed.c     | 10 ++++++++--
      9  2 files changed, 9 insertions(+), 2 deletions(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 51bb13d..6936f95 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -14,6 +14,7 @@ static const char titletrim[]   = "...";
     16  static const int  tabwidth      = 200;
     17  static const Bool foreground    = True;
     18  static       Bool urgentswitch  = False;
     19 +static const int  separator     = 4;
     20  
     21  /*
     22   * Where to place a new tab when it is opened. When npisrelative is True,
     23 diff --git a/tabbed.c b/tabbed.c
     24 index eafe28a..1c38725 100644
     25 --- a/tabbed.c
     26 +++ b/tabbed.c
     27 @@ -381,10 +381,16 @@ drawtext(const char *text, XftColor col[ColLast])
     28  	int i, j, x, y, h, len, olen;
     29  	char buf[256];
     30  	XftDraw *d;
     31 -	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
     32 +	XRectangle tab = { dc.x+separator, dc.y, dc.w-separator, dc.h };
     33 +	XRectangle sep = { dc.x, dc.y, separator, dc.h };
     34  
     35 +	if (separator) {
     36 +		XSetForeground(dpy, dc.gc, col[ColFG].pixel);
     37 +		XFillRectangles(dpy, dc.drawable, dc.gc, &sep, 1);
     38 +	}
     39  	XSetForeground(dpy, dc.gc, col[ColBG].pixel);
     40 -	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
     41 +	XFillRectangles(dpy, dc.drawable, dc.gc, &tab, 1);
     42 +
     43  	if (!text)
     44  		return;
     45  
     46 -- 
     47 2.25.1
     48