Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.0 KiB

4 years ago
  1. From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001
  2. From: aleks <aleks.stier@icloud.com>
  3. Date: Mon, 6 May 2019 16:34:58 +0200
  4. Subject: [PATCH] Add deck-layout
  5. deck is a dwm-layout which is inspired by the TTWM window manager.
  6. It applies the monocle-layout to the clients in the stack.
  7. The master-client is still visible. The stacked clients are like
  8. a deck of cards, hence the name.
  9. The vanilla patch doesn't work properly with patches which add gaps.
  10. This means that when the deck-layout is activated gaps are omitted.
  11. To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
  12. on top of the dwm-deck patch.
  13. The vanilla patch doesn't respect the master-area which is defined by
  14. the rmaster-patch. To make it work with the rmaster-patch apply the
  15. dwm-deck-rmaster patch on top of the dwm-deck patch.
  16. ---
  17. config.def.h | 2 ++
  18. dwm.c | 26 ++++++++++++++++++++++++++
  19. 2 files changed, 28 insertions(+)
  20. diff --git a/config.def.h b/config.def.h
  21. index 77ff358..55d8a07 100644
  22. --- a/config.def.h
  23. +++ b/config.def.h
  24. @@ -32,6 +32,7 @@ static const Layout layouts[] = {
  25. { "[]=", tile }, /* first entry is default */
  26. { "><>", NULL }, /* no layout function means floating behavior */
  27. { "[M]", monocle },
  28. + { "[D]", deck },
  29. };
  30. /* key definitions */
  31. @@ -66,6 +67,7 @@ static Key keys[] = {
  32. { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
  33. { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
  34. { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
  35. + { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
  36. { MODKEY, XK_space, setlayout, {0} },
  37. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  38. { MODKEY, XK_0, view, {.ui = ~0 } },
  39. diff --git a/dwm.c b/dwm.c
  40. index 1d78655..356ab44 100644
  41. --- a/dwm.c
  42. +++ b/dwm.c
  43. @@ -171,6 +171,7 @@ static void configure(Client *c);
  44. static void configurenotify(XEvent *e);
  45. static void configurerequest(XEvent *e);
  46. static Monitor *createmon(void);
  47. +static void deck(Monitor *m);
  48. static void destroynotify(XEvent *e);
  49. static void detach(Client *c);
  50. static void detachstack(Client *c);
  51. @@ -669,6 +670,31 @@ destroynotify(XEvent *e) {
  52. unmanage(c, True);
  53. }
  54. +void
  55. +deck(Monitor *m) {
  56. + unsigned int i, n, h, mw, my;
  57. + Client *c;
  58. +
  59. + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  60. + if(n == 0)
  61. + return;
  62. +
  63. + if(n > m->nmaster) {
  64. + mw = m->nmaster ? m->ww * m->mfact : 0;
  65. + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
  66. + }
  67. + else
  68. + mw = m->ww;
  69. + for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  70. + if(i < m->nmaster) {
  71. + h = (m->wh - my) / (MIN(n, m->nmaster) - i);
  72. + resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
  73. + my += HEIGHT(c);
  74. + }
  75. + else
  76. + resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
  77. +}
  78. +
  79. void
  80. detach(Client *c) {
  81. Client **tc;
  82. --
  83. 2.21.0