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