summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-09-09 23:27:10 +0200
committerbakkeby <[email protected]>2019-09-09 23:27:10 +0200
commit4a17b880ad2cc4ae9098809ca3ccf4d439127450 (patch)
tree36b7f8f8f29f1b032e013bc6a28e6647f8f31248
parent1552bf22c040e623a14edf6bae8ffb34bb60eb18 (diff)
downloaddwm-flexipatch-4a17b880ad2cc4ae9098809ca3ccf4d439127450.tar.gz
dwm-flexipatch-4a17b880ad2cc4ae9098809ca3ccf4d439127450.zip
Adding alternativetags patch
-rw-r--r--README.md7
-rw-r--r--config.def.h6
-rw-r--r--dwm.c13
-rw-r--r--patch/alternativetags.c6
-rw-r--r--patch/alternativetags.h1
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patches.h6
8 files changed, 46 insertions, 1 deletions
diff --git a/README.md b/README.md
index 3a79434..98f65d1 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/config.def.h b/config.def.h
index 84e98ca..4b24161 100644
--- a/config.def.h
+++ b/config.def.h
@@ -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 } },
diff --git a/dwm.c b/dwm.c
index 495deb6..3e40820 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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,
diff --git a/patch/alternativetags.c b/patch/alternativetags.c
new file mode 100644
index 0000000..3c329bc
--- /dev/null
+++ b/patch/alternativetags.c
@@ -0,0 +1,6 @@
+void
+togglealttag()
+{
+ selmon->alttag = !selmon->alttag;
+ drawbar(selmon);
+} \ No newline at end of file
diff --git a/patch/alternativetags.h b/patch/alternativetags.h
new file mode 100644
index 0000000..2c130f3
--- /dev/null
+++ b/patch/alternativetags.h
@@ -0,0 +1 @@
+static void togglealttag(); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 9987be0..04d66f4 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -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
diff --git a/patch/include.h b/patch/include.h
index 7912b30..f76f6f1 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -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
diff --git a/patches.h b/patches.h
index d16c280..6673f77 100644
--- a/patches.h
+++ b/patches.h
@@ -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.