sites

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

commit c62f035c05c2db607b8ed1870dc43da0384957d2
parent d33f3953cdca6a8f8170371f9021fdad5e5f211d
Author: Jacob F <jacobcfong@gmail.com>
Date:   Mon,  5 Jun 2023 17:07:19 -0700

Added new patch for tabbed: basenames

Some tabbed clients (zathura) have full paths for names. When many are
open, the bar is hard to read. This patch adds the option to draw only
the basenames of client names in the bar. Commit includes screenshots.

Diffstat:
Atools.suckless.org/tabbed/patches/basenames/basenames.jpg | 0
Atools.suckless.org/tabbed/patches/basenames/index.md | 22++++++++++++++++++++++
Atools.suckless.org/tabbed/patches/basenames/longnames.jpg | 0
Atools.suckless.org/tabbed/patches/basenames/tabbed-basenames-0.7.diff | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 126 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/tabbed/patches/basenames/basenames.jpg b/tools.suckless.org/tabbed/patches/basenames/basenames.jpg Binary files differ. diff --git a/tools.suckless.org/tabbed/patches/basenames/index.md b/tools.suckless.org/tabbed/patches/basenames/index.md @@ -0,0 +1,22 @@ +Basenames +============= +Show only the basename of the tabbed title; useful with zathura. +Toggle with `-b`. + +From this: + +![longnames_screenshot](longnames.jpg) + +To this: + +![basenames_screenshot](basenames.jpg) + + +Download +-------- +* [tabbed-basenames-0.7.diff](tabbed-basenames-0.7.diff) + +Author +------ +* Jacob F <jacobcfong@gmail.com> + diff --git a/tools.suckless.org/tabbed/patches/basenames/longnames.jpg b/tools.suckless.org/tabbed/patches/basenames/longnames.jpg Binary files differ. diff --git a/tools.suckless.org/tabbed/patches/basenames/tabbed-basenames-0.7.diff b/tools.suckless.org/tabbed/patches/basenames/tabbed-basenames-0.7.diff @@ -0,0 +1,104 @@ +From a682145f0daf599b6d2f6c1326f064ec67b30f73 Mon Sep 17 00:00:00 2001 +From: Jacob Fong <jacobcfong@gmail.com> +Date: Mon, 5 Jun 2023 15:57:54 -0700 +Subject: [PATCH] Added `-b` to display only basenames of tab titles. + +--- + tabbed.1 | 3 +++ + tabbed.c | 24 ++++++++++++++++++++++-- + 2 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/tabbed.1 b/tabbed.1 +index 07bdbd7..4a9c110 100644 +--- a/tabbed.1 ++++ b/tabbed.1 +@@ -106,6 +106,9 @@ defines the urgent background color. + .BI \-U " urgfgbcol" + defines the urgent foreground color. + .TP ++.BI \-b ++print only basenames of tab titles. ++.TP + .B \-v + prints version information to stderr, then exits. + .SH USAGE +diff --git a/tabbed.c b/tabbed.c +index eafe28a..03b0c8c 100644 +--- a/tabbed.c ++++ b/tabbed.c +@@ -80,6 +80,7 @@ typedef struct { + + typedef struct { + char name[256]; ++ char *basename; + Window win; + int tabx; + Bool urgent; +@@ -106,6 +107,7 @@ static void focusonce(const Arg *arg); + static void focusurgent(const Arg *arg); + static void fullscreen(const Arg *arg); + static char *getatom(int a); ++static char *getbasename(const char *name); + static int getclient(Window w); + static XftColor getcolor(const char *colstr); + static int getfirsttab(void); +@@ -156,7 +158,7 @@ static int bh, obh, wx, wy, ww, wh; + static unsigned int numlockmask; + static Bool running = True, nextfocus, doinitspawn = True, + fillagain = False, closelastclient = False, +- killclientsfirst = False; ++ killclientsfirst = False, basenametitles = False; + static Display *dpy; + static DC dc; + static Atom wmatom[WMLast]; +@@ -367,7 +369,10 @@ drawbar(void) + } else { + col = clients[c]->urgent ? dc.urg : dc.norm; + } +- drawtext(clients[c]->name, col); ++ if (basenametitles) ++ drawtext(clients[c]->basename, col); ++ else ++ drawtext(clients[c]->name, col); + dc.x += dc.w; + clients[c]->tabx = dc.x; + } +@@ -557,6 +562,16 @@ getatom(int a) + return buf; + } + ++char * ++getbasename(const char *name) ++{ ++ char *pos = strrchr(name, '/'); ++ if (pos) ++ return pos+1; ++ else ++ return (char *)name; ++} ++ + int + getclient(Window w) + { +@@ -1217,6 +1232,8 @@ updatetitle(int c) + sizeof(clients[c]->name))) + gettextprop(clients[c]->win, XA_WM_NAME, clients[c]->name, + sizeof(clients[c]->name)); ++ if (basenametitles) ++ clients[c]->basename = getbasename(clients[c]->name); + if (sel == c) + xsettitle(win, clients[c]->name); + drawbar(); +@@ -1333,6 +1350,9 @@ main(int argc, char *argv[]) + case 'u': + urgbgcolor = EARGF(usage()); + break; ++ case 'b': ++ basenametitles = True; ++ break; + case 'v': + die("tabbed-"VERSION", © 2009-2016 tabbed engineers, " + "see LICENSE for details.\n"); +-- +2.40.0 +