sites

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

tabbed-hidetabs-0.9.diff (2557B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 3b8ac97..35b2423 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -63,10 +63,13 @@ static const Key keys[] = {
      6  	{ MODKEY|ShiftMask,     XK_u,      toggle,      { .v = (void*) &urgentswitch } },
      7 
      8  	{ 0,                    XK_F11,    fullscreen,  { 0 } },
      9 +
     10 +	{ MODKEY,               XK_Shift_L, showbar,    { .i = 1 } },
     11 +	{ ShiftMask,            XK_Control_L, showbar,    { .i = 1 } },
     12  };
     13 
     14  static Key keyreleases[] = {
     15  	/* modifier             key          function     argument */
     16 -	{ 0,                    XK_Shift_L,  NULL,   { 0 } },
     17 -
     18 +	{ MODKEY|ShiftMask,     XK_Shift_L,  showbar,     { .i = 0 } },
     19 +	{ MODKEY|ShiftMask,     XK_Control_L,  showbar,     { .i = 0 } },
     20  };
     21 diff --git a/tabbed.c b/tabbed.c
     22 index 017deb2..f4e6c63 100644
     23 --- a/tabbed.c
     24 +++ b/tabbed.c
     25 @@ -127,6 +127,7 @@ static void run(void);
     26  static void sendxembed(int c, long msg, long detail, long d1, long d2);
     27  static void setcmd(int argc, char *argv[], int);
     28  static void setup(void);
     29 +static void showbar(const Arg *arg);
     30  static void spawn(const Arg *arg);
     31  static int textnw(const char *text, unsigned int len);
     32  static void toggle(const Arg *arg);
     33 @@ -154,7 +155,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
     34  	[MapRequest] = maprequest,
     35  	[PropertyNotify] = propertynotify,
     36  };
     37 -static int bh, obh, wx, wy, ww, wh;
     38 +static int bh, obh, wx, wy, ww, wh, vbh;
     39  static unsigned int numlockmask;
     40  static Bool running = True, nextfocus, doinitspawn = True,
     41              fillagain = False, closelastclient = False,
     42 @@ -171,6 +172,7 @@ static char winid[64];
     43  static char **cmd;
     44  static char *wmname = "tabbed";
     45  static const char *geometry;
     46 +static Bool barvisibility = False;
     47 
     48  char *argv0;
     49 
     50 @@ -326,9 +328,18 @@ void
     51  drawbar(void)
     52  {
     53  	XftColor *col;
     54 -	int c, cc, fc, width;
     55 +	int c, cc, fc, width, nbh;
     56  	char *name = NULL;
     57 
     58 +	nbh = barvisibility ? vbh : 0;
     59 +	if (nbh != bh) {
     60 +		bh = nbh;
     61 +		for (c = 0; c < nclients; c++)
     62 +			XMoveResizeWindow(dpy, clients[c]->win, 0, bh, ww, wh-bh);
     63 +	}
     64 +
     65 +	if (bh == 0) return;
     66 +
     67  	if (nclients == 0) {
     68  		dc.x = 0;
     69  		dc.w = ww;
     70 @@ -1031,7 +1042,7 @@ setup(void)
     71  	screen = DefaultScreen(dpy);
     72  	root = RootWindow(dpy, screen);
     73  	initfont(font);
     74 -	bh = dc.h = dc.font.height + 2;
     75 +	vbh = dc.h = dc.font.height + 2;
     76 
     77  	/* init atoms */
     78  	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
     79 @@ -1125,6 +1136,13 @@ setup(void)
     80  	focus(-1);
     81  }
     82 
     83 +void
     84 +showbar(const Arg *arg)
     85 +{
     86 +	barvisibility = arg->i;
     87 +	drawbar();
     88 +}
     89 +
     90  void
     91  spawn(const Arg *arg)
     92  {
     93 --
     94 2.51.0
     95