sowm.h (1543B)
1 #include <X11/Xlib.h> 2 3 #define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next) 4 #define ws_save(W) ws_list[W] = list 5 #define ws_sel(W) list = ws_list[ws = W] 6 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 7 8 #define win_size(W, gx, gy, gw, gh) \ 9 XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \ 10 &(unsigned int){0}, &(unsigned int){0}) 11 12 // Taken from DWM. Many thanks. https://git.suckless.org/dwm 13 #define mod_clean(mask) (mask & ~(numlock|LockMask) & \ 14 (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) 15 16 typedef struct { 17 const char** com; 18 const int i; 19 const Window w; 20 } Arg; 21 22 struct key { 23 unsigned int mod; 24 KeySym keysym; 25 void (*function)(const Arg arg); 26 const Arg arg; 27 }; 28 29 typedef struct client { 30 struct client *next, *prev; 31 int f, wx, wy; 32 unsigned int ww, wh; 33 Window w; 34 } client; 35 36 void button_press(XEvent *e); 37 void button_release(XEvent *e); 38 void configure_request(XEvent *e); 39 void input_grab(Window root); 40 void key_press(XEvent *e); 41 void map_request(XEvent *e); 42 void notify_destroy(XEvent *e); 43 void notify_enter(XEvent *e); 44 void notify_motion(XEvent *e); 45 void run(const Arg arg); 46 void win_add(Window w); 47 void win_center(const Arg arg); 48 void win_del(Window w); 49 void win_fs(const Arg arg); 50 void win_focus(client *c); 51 void win_kill(const Arg arg); 52 void win_prev(const Arg arg); 53 void win_next(const Arg arg); 54 void win_move(const Arg arg); 55 void win_to_ws(const Arg arg); 56 void ws_go(const Arg arg); 57 58 static int xerror() { return 0; }