tabbed

Simple tabbing application for X11.
git clone git://r-36.net/tabbed
Log | Files | Refs | README | LICENSE

commit 76f7c32c6beeceed1f767665f8bdf425de31f273
parent f2152590f18d8258ed545aa6acbf02602180d6e7
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 23 Dec 2017 18:55:51 +0100

Reworking the toggle patch. Rework config.h.

Diffstat:
config.def.h | 11+++++------
tabbed.c | 9+++++++++
2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ /* appearance */ -static const char font[] = "monospace:size=9"; +static const char font[] = "Liberation Mono:pixelsize=15:antialias=true:autohint=true"; static const char* normbgcolor = "#222222"; static const char* normfgcolor = "#cccccc"; static const char* selbgcolor = "#555555"; @@ -12,10 +12,10 @@ static const char before[] = "<"; static const char after[] = ">"; static const char titletrim[] = "..."; static const int tabwidth = 200; -static const Bool foreground = True; +static Bool foreground = True; static Bool urgentswitch = False; Bool showbar = True; /* False means no bar */ -Bool bottombar = True; /* False means top bar */ +Bool bottombar = False; /* False means top bar */ /* * Where to place a new tab when it is opened. When npisrelative is True, @@ -27,9 +27,7 @@ static Bool npisrelative = False; #define SETPROP(p) { \ .v = (char *[]){ "/bin/sh", "-c", \ - "prop=\"`xwininfo -children -id $1 | grep '^ 0x' |" \ - "sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' |" \ - "xargs -0 printf %b | dmenu -l 10`\" &&" \ + "prop=\"`xwininfo -children -id $1 | grep '^ 0x' | sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' | xargs -0 printf %b | dmenu -l 10`\" &&" \ "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ p, winid, NULL \ } \ @@ -65,6 +63,7 @@ static Key keys[] = { \ { MODKEY, XK_u, focusurgent, { .v = NULL } }, { MODKEY|ShiftMask, XK_u, toggle, { .v = (void *)&urgentswitch } }, + { MODKEY|ShiftMask, XK_e, togglefg, { 0 } }, { 0, XK_F11, fullscreen, { 0 } }, }; diff --git a/tabbed.c b/tabbed.c @@ -132,6 +132,7 @@ static void sigchld(int unused); static void spawn(const Arg *arg); static int textnw(const char *text, unsigned int len); static void toggle(const Arg *arg); +static void togglefg(const Arg *arg); static void togglebar(const Arg *arg); static void toggletop(const Arg *arg); static void unmanage(int c); @@ -1135,6 +1136,7 @@ textnw(const char *text, unsigned int len) { XGlyphInfo ext; XftTextExtentsUtf8(dpy, dc.font.xfont, (XftChar8 *) text, len, &ext); + return ext.xOff; } @@ -1145,6 +1147,13 @@ toggle(const Arg *arg) } void +togglefg(const Arg *arg) +{ + foreground = !foreground; + nextfocus = foreground; +} + +void togglebar(const Arg *arg) { showbar = !showbar;