Adding alternativetags patch

This commit is contained in:
bakkeby 2019-09-09 23:27:10 +02:00
parent 1552bf22c0
commit 4a17b880ad
8 changed files with 46 additions and 1 deletions

View File

@ -5,13 +5,15 @@ For example to include the alpha patch then you would only need to flip this set
#define ALPHA_PATCH 1
```
So if you have ever been curious about trying out dwm, but have been discouraged by manual patching, then this may be a good starting point to see what a "fully fledged" dwm can look like. Want to try out the `pertag` patch? Just flip a config and recompile. Once you have found out what works for you and what don't then you should be in a better position to choose patches should you want to start patching from scratch.
Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on the dwm window manager, how to install it and how it works.
---
### Changelog:
2019-09-09 - Added deck, fibonacci (dwindle and spiral), gridmode, gapplessgrid, horizgrid, nrowgrid, centeredmaster and flextile layouts
2019-09-09 - Added deck, fibonacci (dwindle and spiral), gridmode, gapplessgrid, horizgrid, nrowgrid, centeredmaster and flextile layouts. Added alternativetags patch.
2019-09-08 - Added cfacts and vanitygaps patches, added bstack and bstackhoriz layouts
@ -26,6 +28,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [alpha](https://dwm.suckless.org/patches/alpha/)
- adds transparency for the status bar
- [alternativetags](https://dwm.suckless.org/patches/alternativetags/)
- adds alternative tags which can be toggled on the fly for the sole purpose of providing visual aid
- [attachabove](https://dwm.suckless.org/patches/attachabove/)
- new windows are placed above selected client

View File

@ -46,6 +46,9 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
#if ALTERNATIVE_TAGS_PATCH
static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
#endif // ALTERNATIVE_TAGS_PATCH
static const Rule rules[] = {
/* xprop(1):
@ -249,6 +252,9 @@ static Key keys[] = {
{ MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
#endif // TAGSWAPMON_PATCH
#if ALTERNATIVE_TAGS_PATCH
{ MODKEY, XK_n, togglealttag, {0} },
#endif // ALTERNATIVE_TAGS_PATCH
#if CYCLELAYOUTS_PATCH
{ MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },

13
dwm.c
View File

@ -167,6 +167,9 @@ struct Monitor {
Monitor *next;
Window barwin;
const Layout *lt[2];
#if ALTERNATIVE_TAGS_PATCH
unsigned int alttag;
#endif // ALTERNATIVE_TAGS_PATCH
#if PERTAG_PATCH
Pertag *pertag;
#endif // PERTAG_PATCH
@ -914,6 +917,9 @@ void
drawbar(Monitor *m)
{
int x, w, sw = 0;
#if ALTERNATIVE_TAGS_PATCH
int wdelta;
#endif // ALTERNATIVE_TAGS_PATCH
#if FANCYBAR_PATCH
int tw, mw, ew = 0;
unsigned int n = 0;
@ -963,8 +969,15 @@ drawbar(Monitor *m)
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
#if ALTERNATIVE_TAGS_PATCH
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
#endif // ALTERNATIVE_TAGS_PATCH
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
#if ALTERNATIVE_TAGS_PATCH
drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i);
#else
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
#endif // ALTERNATIVE_TAGS_PATCH
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,

6
patch/alternativetags.c Normal file
View File

@ -0,0 +1,6 @@
void
togglealttag()
{
selmon->alttag = !selmon->alttag;
drawbar(selmon);
}

1
patch/alternativetags.h Normal file
View File

@ -0,0 +1 @@
static void togglealttag();

View File

@ -4,6 +4,10 @@
#include "alpha.c"
#endif
#if ALTERNATIVE_TAGS_PATCH
#include "alternativetags.c"
#endif
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
#include "attachx.c"
#endif

View File

@ -4,6 +4,10 @@
#include "alpha.h"
#endif
#if ALTERNATIVE_TAGS_PATCH
#include "alternativetags.h"
#endif
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
#include "attachx.h"
#endif

View File

@ -17,6 +17,12 @@
*/
#define ALPHA_PATCH 0
/* This patch introduces alternative tags which can be switched on the fly for the
* sole purpose of providing visual aid.
* https://dwm.suckless.org/patches/alternativetags/
*/
#define ALTERNATIVE_TAGS_PATCH 0
/* This patch adds new clients above the selected client, instead of always
* becoming the new master. This behaviour is known from Xmonad.
* This patch takes precedence over ATTACHASIDE_PATCH.