Configuration file for DWM on MacBook Air
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.

139 lines
5.7 KiB

18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "config.h"
  6. #include <X11/Xlib.h>
  7. /* mask shorthands, used in event.c and client.c */
  8. #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
  9. #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
  10. #define PROTODELWIN 1
  11. enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
  12. enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
  13. enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
  14. enum { ColFG, ColBG, ColLast }; /* color */
  15. typedef enum {
  16. TopLeft, TopRight, BotLeft, BotRight
  17. } Corner; /* window corners */
  18. typedef union {
  19. const char *cmd;
  20. int i;
  21. } Arg; /* argument type */
  22. typedef struct {
  23. int ascent;
  24. int descent;
  25. int height;
  26. XFontSet set;
  27. XFontStruct *xfont;
  28. } Fnt;
  29. typedef struct {
  30. int x, y, w, h;
  31. unsigned long norm[ColLast];
  32. unsigned long sel[ColLast];
  33. unsigned long status[ColLast];
  34. Drawable drawable;
  35. Fnt font;
  36. GC gc;
  37. } DC; /* draw context */
  38. typedef struct Client Client;
  39. struct Client {
  40. char name[256];
  41. int proto;
  42. int x, y, w, h;
  43. int tx, ty, tw, th; /* title window geometry */
  44. int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  45. int grav;
  46. long flags;
  47. unsigned int border, weight;
  48. Bool isfloat;
  49. Bool *tags;
  50. Client *next;
  51. Client *prev;
  52. Client *snext;
  53. Window win;
  54. Window twin;
  55. };
  56. extern const char *tags[]; /* all tags */
  57. extern char stext[1024]; /* status text */
  58. extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
  59. extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
  60. extern unsigned int ntags, numlockmask; /* number of tags, and dynamic lock mask */
  61. extern void (*handler[LASTEvent])(XEvent *); /* event handler */
  62. extern void (*arrange)(Arg *); /* arrange function, indicates mode */
  63. extern Atom wmatom[WMLast], netatom[NetLast];
  64. extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */
  65. extern Client *clients, *sel, *stack; /* Client containers */
  66. extern Cursor cursor[CurLast];
  67. extern DC dc; /* draw context for everything */
  68. extern Display *dpy;
  69. extern Window root, barwin;
  70. /* client.c */
  71. extern void ban(Client *c); /* ban client from screen */
  72. extern void focus(Client *c); /* focus c, c may be NULL */
  73. extern Client *getclient(Window w); /* return client of w */
  74. extern Client *getctitle(Window w); /* return client of title window */
  75. extern void gravitate(Client *c, Bool invert); /* gravitate c */
  76. extern void killclient(Arg *arg); /* kill c nicely */
  77. extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
  78. extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
  79. extern void setsize(Client *c); /* set the size structs of c */
  80. extern void settitle(Client *c); /* set the name of c */
  81. extern void togglemax(Arg *arg); /* (un)maximize c */
  82. extern void unmanage(Client *c); /* destroy c */
  83. /* draw.c */
  84. extern void drawall(); /* draw all visible client titles and the bar */
  85. extern void drawstatus(); /* draw the bar */
  86. extern void drawtitle(Client *c); /* draw title of c */
  87. extern unsigned long getcolor(const char *colstr); /* return color of colstr */
  88. extern void setfont(const char *fontstr); /* set the font for DC */
  89. extern unsigned int textw(const char *text); /* return the text width of text */
  90. /* event.c */
  91. extern void grabkeys(); /* grab all keys defined in config.h */
  92. extern void procevent(); /* process pending X events */
  93. /* main.c */
  94. extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */
  95. extern void quit(Arg *arg); /* quit dwm nicely */
  96. extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
  97. extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
  98. /* tag.c */
  99. extern void initrregs(); /* initialize regexps of rules defined in config.h */
  100. extern Client *getnext(Client *c); /* returns next visible client */
  101. extern Client *getprev(Client *c); /* returns previous visible client */
  102. extern void settags(Client *c, Client *trans); /* updates tags of c */
  103. extern void tag(Arg *arg); /* tags c accordingly to arg's index */
  104. extern void toggletag(Arg *arg); /* toggles c tags accordingly to arg's index */
  105. /* util.c */
  106. extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
  107. extern void eprint(const char *errstr, ...); /* prints error string and exits with return code 1 */
  108. extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */
  109. extern void spawn(Arg *arg); /* forks a new subprocess accordingly to arg's cmd */
  110. /* view.c */
  111. extern void detach(Client *c); /* detaches c from global client list */
  112. extern void dofloat(Arg *arg); /* arranges all windows in a floating way, arg is ignored */
  113. extern void dotile(Arg *arg); /* arranges all windows in a tiled way, arg is ignored */
  114. extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
  115. extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
  116. extern Bool isvisible(Client *c); /* returns True if client is visible */
  117. extern void resizecol(Arg *arg); /* resizes the master width accordingly to arg's index value */
  118. extern void restack(); /* restores z layers of all clients */
  119. extern void togglemode(Arg *arg); /* toggles global arrange mode (between dotile and dofloat) */
  120. extern void toggleview(Arg *arg); /* makes the tag accordingly to arg's index (in)visible */
  121. extern void view(Arg *arg); /* makes the tag accordingly to arg's index visible */
  122. extern void viewall(Arg *arg); /* makes all tags visible, arg is ignored */
  123. extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */