My build of dwm
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

91 Zeilen
3.3 KiB

  1. diff -up a/config.def.h b/config.def.h
  2. --- a/config.def.h 2019-06-06 21:23:27.006661784 +0200
  3. +++ b/config.def.h 2019-06-20 15:05:59.083102462 +0200
  4. @@ -58,11 +58,14 @@ static const Layout layouts[] = {
  5. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  6. static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
  7. static const char *termcmd[] = { "st", NULL };
  8. +static const char scratchpadname[] = "scratchpad";
  9. +static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
  10. static Key keys[] = {
  11. /* modifier key function argument */
  12. { MODKEY, XK_p, spawn, {.v = dmenucmd } },
  13. { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
  14. + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
  15. { MODKEY, XK_b, togglebar, {0} },
  16. { MODKEY, XK_j, focusstack, {.i = +1 } },
  17. { MODKEY, XK_k, focusstack, {.i = -1 } },
  18. diff -up a/dwm.c b/dwm.c
  19. --- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
  20. +++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
  21. @@ -213,6 +213,7 @@ static void tagmon(const Arg *arg);
  22. static void tile(Monitor *);
  23. static void togglebar(const Arg *arg);
  24. static void togglefloating(const Arg *arg);
  25. +static void togglescratch(const Arg *arg);
  26. static void toggletag(const Arg *arg);
  27. static void toggleview(const Arg *arg);
  28. static void unfocus(Client *c, int setfocus);
  29. @@ -273,6 +274,8 @@ static Window root, wmcheckwin;
  30. /* configuration, allows nested code to access above variables */
  31. #include "config.h"
  32. +static unsigned int scratchtag = 1 << LENGTH(tags);
  33. +
  34. /* compile-time check if all tags fit into an unsigned int bit array. */
  35. struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  36. @@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
  37. && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
  38. c->bw = borderpx;
  39. + selmon->tagset[selmon->seltags] &= ~scratchtag;
  40. + if (!strcmp(c->name, scratchpadname)) {
  41. + c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
  42. + c->isfloating = True;
  43. + c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
  44. + c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
  45. + }
  46. +
  47. wc.border_width = c->bw;
  48. XConfigureWindow(dpy, w, CWBorderWidth, &wc);
  49. XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
  50. @@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
  51. {
  52. if (arg->v == dmenucmd)
  53. dmenumon[0] = '0' + selmon->num;
  54. + selmon->tagset[selmon->seltags] &= ~scratchtag;
  55. if (fork() == 0) {
  56. if (dpy)
  57. close(ConnectionNumber(dpy));
  58. @@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
  59. }
  60. void
  61. +togglescratch(const Arg *arg)
  62. +{
  63. + Client *c;
  64. + unsigned int found = 0;
  65. +
  66. + for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
  67. + if (found) {
  68. + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
  69. + if (newtagset) {
  70. + selmon->tagset[selmon->seltags] = newtagset;
  71. + focus(NULL);
  72. + arrange(selmon);
  73. + }
  74. + if (ISVISIBLE(c)) {
  75. + focus(c);
  76. + restack(selmon);
  77. + }
  78. + } else
  79. + spawn(arg);
  80. +}
  81. +
  82. +void
  83. toggletag(const Arg *arg)
  84. {
  85. unsigned int newtags;