diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-09 16:47:34 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-09 16:47:34 +0900 |
| commit | 7b4b09db1548e6bb6bc60ca64968b24dc2996967 (patch) | |
| tree | 5052e88384bcfc2da3b207de1ac4cdcb7a8a2245 /tabbed/patches/tabbed-basenames-0.7.diff | |
| parent | 28729f1f7e4cdef4534d969733b9178cd689418e (diff) | |
created tabbed/
Diffstat (limited to 'tabbed/patches/tabbed-basenames-0.7.diff')
| -rw-r--r-- | tabbed/patches/tabbed-basenames-0.7.diff | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tabbed/patches/tabbed-basenames-0.7.diff b/tabbed/patches/tabbed-basenames-0.7.diff new file mode 100644 index 0000000..5995ba9 --- /dev/null +++ b/tabbed/patches/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 + |
