Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 12th, 2010  |  syntax: None  |  size: 6.15 KB  |  views: 174  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -up dwm-5.7.2.orig/config.def.h dwm-5.7.2/config.def.h
  2. --- dwm-5.7.2.orig/config.def.h 2010-02-12 17:29:34.000000000 +0100
  3. +++ dwm-5.7.2/config.def.h      2010-02-12 18:29:36.000000000 +0100
  4.  -16,6 +16,9 @@ static const Bool topbar            = Tr
  5.  /* tagging */
  6.  static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
  7.  
  8. +/* initial layouts */
  9. +static const int  initlayouts[] = { 0, 0, 1, 0, 1, 0, 1, 2, 0, 0 };
  10. +
  11.  static const Rule rules[] = {
  12.         /* class      instance    title       tags mask     isfloating   monitor */
  13.         { "Gimp",     NULL,       NULL,       0,            True,        -1 },
  14. Nur in dwm-5.7.2: config.h.
  15. diff -up dwm-5.7.2.orig/dwm.c dwm-5.7.2/dwm.c
  16. --- dwm-5.7.2.orig/dwm.c        2010-02-12 17:29:34.000000000 +0100
  17. +++ dwm-5.7.2/dwm.c     2010-02-12 18:28:53.000000000 +0100
  18.  -120,26 +120,6 @@ typedef struct {
  19.         void (*arrange)(Monitor *);
  20.  } Layout;
  21.  
  22. -struct Monitor {
  23. -       char ltsymbol[16];
  24. -       float mfact;
  25. -       int num;
  26. -       int by;               /* bar geometry */
  27. -       int mx, my, mw, mh;   /* screen size */
  28. -       int wx, wy, ww, wh;   /* window area  */
  29. -       unsigned int seltags;
  30. -       unsigned int sellt;
  31. -       unsigned int tagset[2];
  32. -       Bool showbar;
  33. -       Bool topbar;
  34. -       Client *clients;
  35. -       Client *sel;
  36. -       Client *stack;
  37. -       Monitor *next;
  38. -       Window barwin;
  39. -       const Layout *lt[2];
  40. -};
  41. -
  42.  typedef struct {
  43.         const char *class;
  44.         const char *instance;
  45.  -273,6 +253,31 @@ static Window root;
  46.  /* configuration, allows nested code to access above variables */
  47.  #include "config.h"
  48.  
  49. +struct Monitor {
  50. +       char ltsymbol[16];
  51. +       float mfact;
  52. +       int num;
  53. +       int by;               /* bar geometry */
  54. +       int mx, my, mw, mh;   /* screen size */
  55. +       int wx, wy, ww, wh;   /* window area  */
  56. +       unsigned int seltags;
  57. +       unsigned int sellt;
  58. +       unsigned int tagset[2];
  59. +       Bool showbar;
  60. +       Bool topbar;
  61. +       Client *clients;
  62. +       Client *sel;
  63. +       Client *stack;
  64. +       Monitor *next;
  65. +       Window barwin;
  66. +       const Layout *lt[2];
  67. +       int curtag;
  68. +       int prevtag;
  69. +       const Layout *lts[LENGTH(tags) + 1];
  70. +       double mfacts[LENGTH(tags) + 1];
  71. +       Bool showbars[LENGTH(tags) + 1];
  72. +};
  73. +
  74.  /* compile-time check if all tags fit into an unsigned int bit array. */
  75.  struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  76.  
  77.  -615,7 +620,7 @@ createmon(void) {
  78.         m->topbar = topbar;
  79.         m->lt[0] = &layouts[0];
  80.         m->lt[1] = &layouts[1 % LENGTH(layouts)];
  81. -       strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
  82. +       strncpy(m->ltsymbol, initlayouts[1] && initlayouts[1] < LENGTH(layouts) ? layouts[initlayouts[1]].symbol : layouts[0].symbol, sizeof m->ltsymbol);
  83.         return m;
  84.  }
  85.  
  86.  -1450,7 +1455,7 @@ setlayout(const Arg *arg) {
  87.         if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
  88.                 selmon->sellt ^= 1;
  89.         if(arg && arg->v)
  90. -               selmon->lt[selmon->sellt] = (Layout *)arg->v;
  91. +               selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *)arg->v;
  92.         strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
  93.         if(selmon->sel)
  94.                 arrange(selmon);
  95.  -1468,13 +1473,15 @@ setmfact(const Arg *arg) {
  96.         f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
  97.         if(f < 0.1 || f > 0.9)
  98.                 return;
  99. -       selmon->mfact = f;
  100. +       selmon->mfact = selmon->mfacts[selmon->curtag] = f;
  101.         arrange(selmon);
  102.  }
  103.  
  104.  void
  105.  setup(void) {
  106.         XSetWindowAttributes wa;
  107. +       Monitor *m;
  108. +       unsigned int i;
  109.  
  110.         /* clean up any zombies immediately */
  111.         sigchld(0);
  112.  -1509,7 +1516,27 @@ setup(void) {
  113.         XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
  114.         if(!dc.font.set)
  115.                 XSetFont(dpy, dc.gc, dc.font.xfont->fid);
  116. +       /* init tags */
  117. +       for(m = mons; m; m = m->next)
  118. +               m->curtag = m->prevtag = 1;
  119. +       /* init mfacts */
  120. +       for(m = mons; m; m = m->next) {
  121. +               for(i=0; i < LENGTH(tags) + 1 ; i++) {
  122. +                       m->mfacts[i] = m->mfact;
  123. +               }
  124. +       }
  125. +       /* init layouts */
  126. +       for(m = mons; m; m = m->next) {
  127. +               for(i=0; i < LENGTH(tags) + 1; i++) {
  128. +                       m->lts[i] = initlayouts[i] && initlayouts[i] < LENGTH(layouts) ? &layouts[initlayouts[i]] : &layouts[0];
  129. +               }
  130. +       }
  131.         /* init bars */
  132. +       for(m = mons; m; m = m->next) {
  133. +               for(i=0; i < LENGTH(tags) + 1; i++) {
  134. +                       m->showbars[i] = m->showbar;
  135. +               }
  136. +       }
  137.         updatebars();
  138.         updatestatus();
  139.         /* EWMH support per view */
  140.  -1620,7 +1647,7 @@ tile(Monitor *m) {
  141.  
  142.  void
  143.  togglebar(const Arg *arg) {
  144. -       selmon->showbar = !selmon->showbar;
  145. +       selmon->showbar = selmon->showbars[selmon->curtag] = !selmon->showbar;
  146.         updatebarpos(selmon);
  147.         XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
  148.         arrange(selmon);
  149.  -1640,12 +1667,27 @@ togglefloating(const Arg *arg) {
  150.  void
  151.  toggletag(const Arg *arg) {
  152.         unsigned int newtags;
  153. +       unsigned int i;
  154.  
  155.         if(!selmon->sel)
  156.                 return;
  157.         newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
  158.         if(newtags) {
  159.                 selmon->sel->tags = newtags;
  160. +               if(newtags == ~0) {
  161. +                       selmon->prevtag = selmon->curtag;
  162. +                       selmon->curtag = 0;
  163. +               }
  164. +               if(!(newtags & 1 << (selmon->curtag - 1))) {
  165. +                       selmon->prevtag = selmon->curtag;
  166. +                       for (i=0; !(newtags & 1 << i); i++);
  167. +                       selmon->curtag = i + 1;
  168. +               }
  169. +               selmon->sel->tags = newtags;
  170. +               selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
  171. +               selmon->mfact = selmon->mfacts[selmon->curtag];
  172. +               if (selmon->showbar != selmon->showbars[selmon->curtag])
  173. +                       togglebar(NULL);
  174.                 arrange(selmon);
  175.         }
  176.  }
  177.  -1912,11 +1954,29 @@ updatewmhints(Client *c) {
  178.  
  179.  void
  180.  view(const Arg *arg) {
  181. +       unsigned int i;
  182. +
  183.         if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
  184.                 return;
  185.         selmon->seltags ^= 1; /* toggle sel tagset */
  186. -       if(arg->ui & TAGMASK)
  187. +       if(arg->ui & TAGMASK) {
  188.                 selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
  189. +               selmon->prevtag = selmon->curtag;
  190. +               if(arg->ui == ~0)
  191. +                       selmon->curtag = 0;
  192. +               else {
  193. +                       for (i=0; !(arg->ui & 1 << i); i++);
  194. +                       selmon->curtag = i + 1;
  195. +               }
  196. +       } else {
  197. +               selmon->prevtag= selmon->curtag ^ selmon->prevtag;
  198. +               selmon->curtag^= selmon->prevtag;
  199. +               selmon->prevtag= selmon->curtag ^ selmon->prevtag;
  200. +       }
  201. +       selmon->lt[selmon->sellt]= selmon->lts[selmon->curtag];
  202. +       selmon->mfact = selmon->mfacts[selmon->curtag];
  203. +       if(selmon->showbar != selmon->showbars[selmon->curtag])
  204. +               togglebar(NULL);
  205.         arrange(selmon);
  206.  }
clone this paste RAW Paste Data