tabbed

Mahdi's build of tabbed
git clone git://mahdi.pw/tabbed.git
Log | Files | Refs | README | LICENSE

tabbed-hidetabs-20191216-b5f9ec6.diff (2880B)


      1 From 52708d468acace9543d01e6d8afae799f8d6fccd Mon Sep 17 00:00:00 2001
      2 From: LeelaPakanati <[email protected]>
      3 Date: Mon, 16 Dec 2019 18:57:32 -0500
      4 Subject: [PATCH] Add hide tabs feature
      5 
      6 ---
      7  config.def.h |  7 +++++--
      8  tabbed.c     | 24 +++++++++++++++++++++---
      9  2 files changed, 26 insertions(+), 5 deletions(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 7bfda30..bb7ef0e 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -63,10 +63,13 @@ static Key keys[] = {
     16  	{ MODKEY|ShiftMask,     XK_u,      toggle,      { .v = (void*) &urgentswitch } },
     17  
     18  	{ 0,                    XK_F11,    fullscreen,  { 0 } },
     19 +
     20 +	{ MODKEY,               XK_Shift_L, showbar,    { .i = 1 } },
     21 +	{ ShiftMask,            XK_Control_L, showbar,    { .i = 1 } },
     22  };
     23  
     24  static Key keyreleases[] = {
     25  	/* modifier             key          function     argument */
     26 -	{ 0,                    XK_Shift_L,  NULL,   { 0 } },
     27 -
     28 +	{ MODKEY|ShiftMask,     XK_Shift_L,  showbar,     { .i = 0 } },
     29 +	{ MODKEY|ShiftMask,     XK_Control_L,  showbar,     { .i = 0 } },
     30  };
     31 diff --git a/tabbed.c b/tabbed.c
     32 index fe38b9d..352dab2 100644
     33 --- a/tabbed.c
     34 +++ b/tabbed.c
     35 @@ -127,6 +127,7 @@ static void sendxembed(int c, long msg, long detail, long d1, long d2);
     36  static void setcmd(int argc, char *argv[], int);
     37  static void setup(void);
     38  static void sigchld(int unused);
     39 +static void showbar(const Arg *arg);
     40  static void spawn(const Arg *arg);
     41  static int textnw(const char *text, unsigned int len);
     42  static void toggle(const Arg *arg);
     43 @@ -154,7 +155,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
     44  	[MapRequest] = maprequest,
     45  	[PropertyNotify] = propertynotify,
     46  };
     47 -static int bh, wx, wy, ww, wh;
     48 +static int bh, wx, wy, ww, wh, vbh;
     49  static unsigned int numlockmask;
     50  static Bool running = True, nextfocus, doinitspawn = True,
     51              fillagain = False, closelastclient = False,
     52 @@ -171,6 +172,7 @@ static char winid[64];
     53  static char **cmd;
     54  static char *wmname = "tabbed";
     55  static const char *geometry;
     56 +static Bool barvisibility = False;
     57  
     58  char *argv0;
     59  
     60 @@ -317,9 +319,18 @@ void
     61  drawbar(void)
     62  {
     63  	XftColor *col;
     64 -	int c, cc, fc, width;
     65 +	int c, cc, fc, width, nbh;
     66  	char *name = NULL;
     67  
     68 +	nbh = barvisibility ? vbh : 0;
     69 +	if (nbh != bh) {
     70 +		bh = nbh;
     71 +		for (c = 0; c < nclients; c++)
     72 +			XMoveResizeWindow(dpy, clients[c]->win, 0, bh, ww, wh-bh);
     73 +	}
     74 +
     75 +	if (bh == 0) return;
     76 +
     77  	if (nclients == 0) {
     78  		dc.x = 0;
     79  		dc.w = ww;
     80 @@ -1003,7 +1014,7 @@ setup(void)
     81  	screen = DefaultScreen(dpy);
     82  	root = RootWindow(dpy, screen);
     83  	initfont(font);
     84 -	bh = dc.h = dc.font.height + 2;
     85 +	vbh = dc.h = dc.font.height + 2;
     86  
     87  	/* init atoms */
     88  	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
     89 @@ -1096,6 +1107,13 @@ setup(void)
     90  	focus(-1);
     91  }
     92  
     93 +void
     94 +showbar(const Arg *arg)
     95 +{
     96 +	barvisibility = arg->i;
     97 +	drawbar();
     98 +}
     99 +
    100  void
    101  sigchld(int unused)
    102  {
    103 -- 
    104 2.24.0
    105