Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
This dwm 6.3 (e0dee91, 2022-08-08) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
|
||||
This dwm 6.3 (44adafe, 2022-08-11) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
|
||||
|
||||
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h):
|
||||
```c
|
||||
@@ -19,6 +19,8 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
|
||||
|
||||
### Changelog:
|
||||
|
||||
2022-08-12 - Added the nametag patch
|
||||
|
||||
2022-08-02 - Added the bidi patch
|
||||
|
||||
2022-07-05 - Added the tagpreview patch
|
||||
@@ -528,6 +530,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
|
||||
- [movestack](https://dwm.suckless.org/patches/movestack/)
|
||||
- allows you to move clients around in the stack and swap them with the master
|
||||
|
||||
- [nametag](https://dwm.suckless.org/patches/nametag/)
|
||||
- allows the names of tags to be changed during runtime
|
||||
|
||||
- [netclientliststacking](https://github.com/bakkeby/patches/wiki/netclientliststacking)
|
||||
- adds support for the \_NET\_CLIENT\_LIST\_STACKING atom, needed by certain applications
|
||||
like the Zoom video conferencing application
|
||||
|
80
README.org
80
README.org
@@ -109,6 +109,7 @@
|
||||
- [[#move-place][Move Place]]
|
||||
- [[#move-resize][Move Resize]]
|
||||
- [[#move-stack][Move Stack]]
|
||||
- [[#name-tag][Name Tag]]
|
||||
- [[#net-client-list-stacking][Net Client List Stacking]]
|
||||
- [[#no-border][No Border]]
|
||||
- [[#no-dmenu][No Dmenu]]
|
||||
@@ -277,7 +278,7 @@ exec dwm
|
||||
|
||||
* dwm flexipatch
|
||||
|
||||
This dwm 6.3 (e0dee91, 2022-08-08) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [[https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0][dwm-flexipatch-1.0]].
|
||||
This dwm 6.3 (44adafe, 2022-08-11) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [[https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0][dwm-flexipatch-1.0]].
|
||||
|
||||
For example to include the ~alpha~ patch then you would only need to flip this setting from 0 to 1 in [[https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h][patches.h]]:
|
||||
|
||||
@@ -297,6 +298,8 @@ Browsing patches? There is a [[https://coggle.it/diagram/X9IiSSM6PTWOM9Wz][map o
|
||||
|
||||
** Changelog
|
||||
|
||||
2022-08-12 - Added the nametag patch
|
||||
|
||||
2022-08-02 - Added the bidi patch
|
||||
|
||||
2022-07-05 - Added the tagpreview patch
|
||||
@@ -758,6 +761,9 @@ Browsing patches? There is a [[https://coggle.it/diagram/X9IiSSM6PTWOM9Wz][map o
|
||||
- [[https://dwm.suckless.org/patches/movestack/][movestack]]
|
||||
- allows you to move clients around in the stack and swap them with the master
|
||||
|
||||
- [[https://dwm.suckless.org/patches/nametag/][nametag]]
|
||||
- allows the names of tags to be changed during runtime
|
||||
|
||||
- [[https://github.com/bakkeby/patches/wiki/netclientliststacking][netclientliststacking]]
|
||||
- adds support for the =_NET_CLIENT_LIST_STACKING= atom, needed by certain applications like the Zoom video conferencing application
|
||||
|
||||
@@ -2282,6 +2288,42 @@ https://dwm.suckless.org/patches/movestack/
|
||||
#define MOVESTACK_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
*** Name Tag
|
||||
|
||||
**** Main
|
||||
|
||||
This patch allows you to change the names of tags during runtime.
|
||||
|
||||
This is a bespoke version implemented specifically in relation to tagicons, which is integrated
|
||||
into dwm-flexipatch. By default it uses dmenu to retrieve the new name, but this can be
|
||||
customised via config along with the maximum text length and the format string.
|
||||
|
||||
Special behaviour:
|
||||
- if more than one tag is selected then the name change applies to all selected tags
|
||||
- if tagicons is configured to have unique tags per monitor then the change only applies
|
||||
for the current monitor
|
||||
- the name change applies to the tag set that is active for the current tag:
|
||||
* if used in combination with BAR_ALTTAGSDECORATION_PATCH and there are clients on the
|
||||
given tag then the name change only applies to the ALT_TAGS_DECORATION tag set
|
||||
* if used in combination with the BAR_ALTERNATIVE_TAGS_PATCH and alternative tags are
|
||||
shown then the name change only applies to the ALTERNATIVE_TAGS tag set
|
||||
* if used in combination with both then BAR_ALTTAGSDECORATION_PATCH takes precedence
|
||||
* otherwise the name change applies to the DEFAULT_TAGS tag set
|
||||
|
||||
https://dwm.suckless.org/patches/nametag/
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define NAMETAG_PATCH 0
|
||||
#+END_SRC
|
||||
|
||||
**** Prepend
|
||||
|
||||
Variant of the above which prepends the tag number to the given string. The toggle does nothing on its own and need to be enabled in combination with the above.
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define NAMETAG_PREPEND_PATCH 0
|
||||
#+END_SRC
|
||||
|
||||
*** Net Client List Stacking
|
||||
|
||||
Adds support for the _NET_CLIENT_LIST_STACKING atom, needed by certain applications like the Zoom video conferencing application.
|
||||
@@ -3633,6 +3675,24 @@ static const int ulineall = 0; /* 1 to show underline on all ta
|
||||
#endif // BAR_UNDERLINETAGS_PATCH
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC c :tangle config.def.h
|
||||
#if NAMETAG_PATCH
|
||||
#if NAMETAG_PREPEND_PATCH
|
||||
/* The format in which the tag is written when named. E.g. %d: %.12s will write the tag number
|
||||
* followed the first 12 characters of the given string. You can also just use "%d: %s" here. */
|
||||
#define NAMETAG_FORMAT "%d: %.12s"
|
||||
#else
|
||||
#define NAMETAG_FORMAT "%s"
|
||||
#endif // NAMETAG_PREPEND_PATCH
|
||||
/* The maximum amount of bytes reserved for each tag text. */
|
||||
#define MAX_TAGLEN 16
|
||||
/* The command to run (via popen). This can be tailored by adding a prompt, passing other command
|
||||
* line arguments or providing name options. Optionally you can use other dmenu like alternatives
|
||||
* like rofi -dmenu. */
|
||||
#define NAMETAG_COMMAND "dmenu < /dev/null"
|
||||
#endif // NAMETAG_PATCH
|
||||
#+END_SRC
|
||||
|
||||
** Indicators
|
||||
|
||||
See patch/bar_indicators.h for options
|
||||
@@ -4000,7 +4060,12 @@ The first example would result in the tags on the first monitor to be 1 through
|
||||
For the second example each tag would be represented as a bullet point. Both cases work the same from a technical standpoint - the icon index is derived from the tag index and the monitor index. If the icon index is is greater than the number of tag icons then it will wrap around until it an icon matches. Similarly if there are two tag icons then it would alternate between them. This works seamlessly with alternative tags and alttagsdecoration patches.
|
||||
|
||||
#+BEGIN_SRC c :tangle config.def.h
|
||||
static char *tagicons[][NUMTAGS] = {
|
||||
#if NAMETAG_PATCH
|
||||
static char tagicons[][NUMTAGS][MAX_TAGLEN] =
|
||||
#else
|
||||
static char *tagicons[][NUMTAGS] =
|
||||
#endif // NAMETAG_PATCH
|
||||
{
|
||||
/* [DEFAULT_TAGS] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, */
|
||||
[DEFAULT_TAGS] = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" },
|
||||
[ALTERNATIVE_TAGS] = { "A", "B", "C", "D", "E", "F", "G", "H", "I" },
|
||||
@@ -4928,6 +4993,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_n, togglealttag, {0} },
|
||||
#endif // BAR_ALTERNATIVE_TAGS_PATCH
|
||||
|
||||
#if NAMETAG_PATCH
|
||||
{ MODKEY|ShiftMask, XK_n, nametag, {0} },
|
||||
#endif // NAMETAG_PATCH
|
||||
|
||||
#if BAR_TAGGRID_PATCH
|
||||
{ MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } },
|
||||
{ MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } },
|
||||
@@ -4951,6 +5020,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_KP_3, moveplace, {.ui = WIN_SE }}, /* XK_KP_Next, */
|
||||
#endif // MOVEPLACE_PATCH
|
||||
|
||||
#if NAMETAG_PATCH
|
||||
{ "nametag", nametag },
|
||||
#endif // NAMETAG_PATCH
|
||||
|
||||
#if EXRESIZE_PATCH
|
||||
{ MODKEY, XK_KP_7, explace, {.ui = EX_NW }}, /* XK_KP_Home, */
|
||||
{ MODKEY, XK_KP_8, explace, {.ui = EX_N }}, /* XK_KP_Up, */
|
||||
@@ -5425,6 +5498,9 @@ static IPCCommand ipccommands[] = {
|
||||
#if MOVERESIZE_PATCH
|
||||
IPCCOMMAND( moveresize, 1, {ARG_TYPE_STR} ),
|
||||
#endif // MOVERESIZE_PATCH
|
||||
#if NAMETAG_PATCH
|
||||
IPCCOMMAND( nametag, 1, {ARG_TYPE_NONE} ),
|
||||
#endif // NAMETAG_PATCH
|
||||
#if RIODRAW_PATCH
|
||||
IPCCOMMAND( rioresize, 1, {ARG_TYPE_NONE} ),
|
||||
#endif // RIODRAW_PATCH
|
||||
|
34
config.def.h
34
config.def.h
@@ -125,6 +125,22 @@ static const unsigned int ulinevoffset = 0; /* how far above the bottom of t
|
||||
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
#endif // BAR_UNDERLINETAGS_PATCH
|
||||
|
||||
#if NAMETAG_PATCH
|
||||
#if NAMETAG_PREPEND_PATCH
|
||||
/* The format in which the tag is written when named. E.g. %d: %.12s will write the tag number
|
||||
* followed the first 12 characters of the given string. You can also just use "%d: %s" here. */
|
||||
#define NAMETAG_FORMAT "%d: %.12s"
|
||||
#else
|
||||
#define NAMETAG_FORMAT "%s"
|
||||
#endif // NAMETAG_PREPEND_PATCH
|
||||
/* The maximum amount of bytes reserved for each tag text. */
|
||||
#define MAX_TAGLEN 16
|
||||
/* The command to run (via popen). This can be tailored by adding a prompt, passing other command
|
||||
* line arguments or providing name options. Optionally you can use other dmenu like alternatives
|
||||
* like rofi -dmenu. */
|
||||
#define NAMETAG_COMMAND "dmenu < /dev/null"
|
||||
#endif // NAMETAG_PATCH
|
||||
|
||||
static int tagindicatortype = INDICATOR_TOP_LEFT_SQUARE;
|
||||
static int tiledindicatortype = INDICATOR_NONE;
|
||||
static int floatindicatortype = INDICATOR_TOP_LEFT_SQUARE;
|
||||
@@ -409,7 +425,12 @@ static Sp scratchpads[] = {
|
||||
};
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
|
||||
static char *tagicons[][NUMTAGS] = {
|
||||
#if NAMETAG_PATCH
|
||||
static char tagicons[][NUMTAGS][MAX_TAGLEN] =
|
||||
#else
|
||||
static char *tagicons[][NUMTAGS] =
|
||||
#endif // NAMETAG_PATCH
|
||||
{
|
||||
/* [DEFAULT_TAGS] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, */
|
||||
[DEFAULT_TAGS] = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" },
|
||||
[ALTERNATIVE_TAGS] = { "A", "B", "C", "D", "E", "F", "G", "H", "I" },
|
||||
@@ -1233,6 +1254,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_n, togglealttag, {0} },
|
||||
#endif // BAR_ALTERNATIVE_TAGS_PATCH
|
||||
|
||||
#if NAMETAG_PATCH
|
||||
{ MODKEY|ShiftMask, XK_n, nametag, {0} },
|
||||
#endif // NAMETAG_PATCH
|
||||
|
||||
#if BAR_TAGGRID_PATCH
|
||||
{ MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } },
|
||||
{ MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } },
|
||||
@@ -1256,6 +1281,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_KP_3, moveplace, {.ui = WIN_SE }}, /* XK_KP_Next, */
|
||||
#endif // MOVEPLACE_PATCH
|
||||
|
||||
#if NAMETAG_PATCH
|
||||
{ "nametag", nametag },
|
||||
#endif // NAMETAG_PATCH
|
||||
|
||||
#if EXRESIZE_PATCH
|
||||
{ MODKEY, XK_KP_7, explace, {.ui = EX_NW }}, /* XK_KP_Home, */
|
||||
{ MODKEY, XK_KP_8, explace, {.ui = EX_N }}, /* XK_KP_Up, */
|
||||
@@ -1722,6 +1751,9 @@ static IPCCommand ipccommands[] = {
|
||||
#if MOVERESIZE_PATCH
|
||||
IPCCOMMAND( moveresize, 1, {ARG_TYPE_STR} ),
|
||||
#endif // MOVERESIZE_PATCH
|
||||
#if NAMETAG_PATCH
|
||||
IPCCOMMAND( nametag, 1, {ARG_TYPE_NONE} ),
|
||||
#endif // NAMETAG_PATCH
|
||||
#if RIODRAW_PATCH
|
||||
IPCCOMMAND( rioresize, 1, {ARG_TYPE_NONE} ),
|
||||
#endif // RIODRAW_PATCH
|
||||
|
14
dwm.c
14
dwm.c
@@ -2465,14 +2465,12 @@ manage(Window w, XWindowAttributes *wa)
|
||||
#endif // SWALLOW_PATCH
|
||||
}
|
||||
|
||||
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
|
||||
c->x = c->mon->mx + c->mon->mw - WIDTH(c);
|
||||
if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
|
||||
c->y = c->mon->my + c->mon->mh - HEIGHT(c);
|
||||
c->x = MAX(c->x, c->mon->mx);
|
||||
/* only fix client y-offset, if the client center might cover the bar */
|
||||
c->y = MAX(c->y, ((!c->mon->bar || c->mon->bar->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
|
||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||
if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww)
|
||||
c->x = c->mon->wx + c->mon->ww - WIDTH(c);
|
||||
if (c->y + HEIGHT(c) > c->mon->wy + c->mon->wh)
|
||||
c->y = c->mon->wy + c->mon->wh - HEIGHT(c);
|
||||
c->x = MAX(c->x, c->mon->wx);
|
||||
c->y = MAX(c->y, c->mon->wy);
|
||||
|
||||
wc.border_width = c->bw;
|
||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||
|
@@ -10,6 +10,7 @@ case $# in
|
||||
focusurgent) ;&
|
||||
mirrorlayout) ;&
|
||||
mpdcontrol) ;&
|
||||
nametag) ;&
|
||||
pushdown) ;&
|
||||
pushup) ;&
|
||||
self_restart) ;&
|
||||
|
@@ -193,6 +193,9 @@
|
||||
#if MOVESTACK_PATCH
|
||||
#include "movestack.c"
|
||||
#endif
|
||||
#if NAMETAG_PATCH
|
||||
#include "nametag.c"
|
||||
#endif
|
||||
#if NO_MOD_BUTTONS_PATCH
|
||||
#include "nomodbuttons.c"
|
||||
#endif
|
||||
|
@@ -192,6 +192,9 @@
|
||||
#if MOVESTACK_PATCH
|
||||
#include "movestack.h"
|
||||
#endif
|
||||
#if NAMETAG_PATCH
|
||||
#include "nametag.h"
|
||||
#endif
|
||||
#if NO_MOD_BUTTONS_PATCH
|
||||
#include "nomodbuttons.h"
|
||||
#endif
|
||||
|
61
patch/nametag.c
Normal file
61
patch/nametag.c
Normal file
@@ -0,0 +1,61 @@
|
||||
void
|
||||
nametag(const Arg *arg)
|
||||
{
|
||||
char *p, name[MAX_TAGLEN];
|
||||
FILE *f;
|
||||
int i, group;
|
||||
int tagindex;
|
||||
Monitor *m = selmon;
|
||||
#if BAR_ALTTAGSDECORATION_PATCH
|
||||
Client *c;
|
||||
int occ = 0;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
#endif // BAR_ALTTAGSDECORATION_PATCH
|
||||
|
||||
errno = 0; // popen(3p) says on failure it "may" set errno
|
||||
if (!(f = popen(NAMETAG_COMMAND, "r"))) {
|
||||
fprintf(stderr, "dwm: popen command failed%s%s\n", errno ? ": " : "", errno ? strerror(errno) : "");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(p = fgets(name, MAX_TAGLEN, f)) && (i = errno) && ferror(f))
|
||||
fprintf(stderr, "dwm: fgets failed: %s\n", strerror(i));
|
||||
|
||||
pclose(f);
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
if ((p = strchr(name, '\n')))
|
||||
*p = '\0';
|
||||
|
||||
for (i = 0; i < NUMTAGS; i++) {
|
||||
if (m->tagset[m->seltags] & (1 << i)) {
|
||||
|
||||
tagindex = i + NUMTAGS * m->num;
|
||||
if (tagindex >= LENGTH(tagicons[DEFAULT_TAGS]))
|
||||
tagindex = tagindex % LENGTH(tagicons[DEFAULT_TAGS]);
|
||||
|
||||
#if BAR_ALTTAGSDECORATION_PATCH
|
||||
if (occ & 1 << i)
|
||||
group = ALT_TAGS_DECORATION;
|
||||
else
|
||||
#endif // BAR_ALTTAGSDECORATION_PATCH
|
||||
#if BAR_ALTERNATIVE_TAGS_PATCH
|
||||
if (m->alttag)
|
||||
group = ALTERNATIVE_TAGS;
|
||||
else
|
||||
#endif // BAR_ALTERNATIVE_TAGS_PATCH
|
||||
group = DEFAULT_TAGS;
|
||||
|
||||
#if NAMETAG_PREPEND_PATCH
|
||||
if (snprintf(tagicons[group][i], MAX_TAGLEN, NAMETAG_FORMAT, i+1, name) < 0)
|
||||
fprintf(stderr, "nametag: if statement to avoid -Wformat-truncation= warnings\n");
|
||||
#else
|
||||
snprintf(tagicons[group][i], MAX_TAGLEN, NAMETAG_FORMAT, name);
|
||||
#endif // NAMETAG_PREPEND_PATCH
|
||||
}
|
||||
}
|
||||
drawbars();
|
||||
}
|
1
patch/nametag.h
Normal file
1
patch/nametag.h
Normal file
@@ -0,0 +1 @@
|
||||
static void nametag(const Arg *arg);
|
@@ -207,6 +207,10 @@
|
||||
|
||||
#define MOVESTACK_PATCH 1
|
||||
|
||||
#define NAMETAG_PATCH 0
|
||||
|
||||
#define NAMETAG_PREPEND_PATCH 0
|
||||
|
||||
#define NET_CLIENT_LIST_STACKING_PATCH 1
|
||||
|
||||
#define NOBORDER_PATCH 0
|
||||
|
Reference in New Issue
Block a user