sites

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

commit c92c411f147911ec853cf8016ddfb6a64d74df7f
parent d991895444ead75929062ac7a4d835b88c16e246
Author: dthcm <dthcm1@gmail.com>
Date:   Wed, 19 Oct 2022 17:39:07 +0800

Add dwm tagfun patch.

Diffstat:
Adwm.suckless.org/patches/tagfun/dwm-tagfun-6.4.diff | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/tagfun/index.md | 24++++++++++++++++++++++++
2 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/tagfun/dwm-tagfun-6.4.diff b/dwm.suckless.org/patches/tagfun/dwm-tagfun-6.4.diff @@ -0,0 +1,57 @@ +diff --git a/config.def.h b/config.def.h +index 061ad66..8edac81 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -59,6 +59,14 @@ static const Layout layouts[] = { + static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; + static const char *termcmd[] = { "st", NULL }; + ++static struct { ++ void (*func)(const Arg *arg); ++ const Arg arg; ++} tagfun_cmds[LENGTH(tags)] = { ++ [0] = { killclient, {0} }, ++ [1] = { spawn, { .v = termcmd } }, ++}; ++ + static const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +@@ -108,6 +116,7 @@ static const Button buttons[] = { + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, ++ { ClkTagBar, 0, Button2, tagfun, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +diff --git a/dwm.c b/dwm.c +index e5efb6a..79b76cb 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -208,6 +208,7 @@ static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); + static void tag(const Arg *arg); ++static void tagfun(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *m); + static void togglebar(const Arg *arg); +@@ -1658,6 +1659,17 @@ tag(const Arg *arg) + } + } + ++void ++tagfun(const Arg *arg) ++{ ++ unsigned int i = arg->ui & TAGMASK, j = 0; ++ if (i) { ++ while ( i >>= 1) j++; ++ if (tagfun_cmds[j].func) ++ tagfun_cmds[j].func(&tagfun_cmds[j].arg); ++ } ++} ++ + void + tagmon(const Arg *arg) + { diff --git a/dwm.suckless.org/patches/tagfun/index.md b/dwm.suckless.org/patches/tagfun/index.md @@ -0,0 +1,24 @@ +tagfun +====== + +Description +----------- +This patch allows you to bind functions to your tags, invoked with mouse middle button. + +Recommendations +--------------- +This patch tries to improve mouse usability. By default, first tag binds to kill current client, +second tag spawn terminal. Leave the kill client function alone (or bind to else where), +and add some defaults apps to your tags. + +It is recommended to use rofi, combined with launchpad theme, this will provied you +almost fully functional mouse experience. + +Download +-------- +* [dwm-tagfun-6.4.diff](dwm-tagfun-6.4.diff) + +Authors +------- +* dthcm - dthcm1@gmail.com +