nyxwm.h (3145B)
1 #ifndef NYXWM_H 2 #define NYXWM_H 3 4 #include <X11/Xlib.h> 5 #include <X11/Xft/Xft.h> 6 #include <X11/Xatom.h> 7 8 #define SYSTEM_TRAY_REQUEST_DOCK 0 9 #define SYSTEM_TRAY_BEGIN_MESSAGE 1 10 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 11 12 #define XEMBED_EMBEDDED_NOTIFY 0 13 #define XEMBED_WINDOW_ACTIVATE 1 14 #define XEMBED_WINDOW_DEACTIVATE 2 15 #define XEMBED_REQUEST_FOCUS 3 16 #define XEMBED_FOCUS_IN 4 17 #define XEMBED_FOCUS_OUT 5 18 #define XEMBED_FOCUS_NEXT 6 19 #define XEMBED_FOCUS_PREV 7 20 21 #define XEMBED_MODALITY_ON 10 22 #define XEMBED_MODALITY_OFF 11 23 #define XEMBED_REGISTER_ACCELERATOR 12 24 #define XEMBED_UNREGISTER_ACCELERATOR 13 25 #define XEMBED_ACTIVATE_ACCELERATOR 14 26 27 28 #ifndef MAX_SYSTRAY_ICONS 29 #define MAX_SYSTRAY_ICONS 20 30 #endif 31 32 #ifndef BAR_HEIGHT 33 #define BAR_HEIGHT 23 34 #endif 35 36 #define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next) 37 #define ws_save(W) ws_list[W] = list 38 #define ws_sel(W) list = ws_list[ws = W] 39 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 40 41 #define win_size(W, gx, gy, gw, gh) \ 42 XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \ 43 &(unsigned int){0}, &(unsigned int){0}) 44 45 // Taken from DWM. Many thanks. https://git.suckless.org/dwm 46 #define mod_clean(mask) (mask & ~(numlock|LockMask) & \ 47 (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) 48 49 typedef struct { 50 char* icon; 51 char* command; 52 unsigned int interval; 53 unsigned int signal; 54 } Block; 55 56 typedef struct { 57 const char** com; 58 const int i; 59 const Window w; 60 } Arg; 61 62 struct key { 63 unsigned int mod; 64 KeySym keysym; 65 void (*function)(const Arg arg); 66 const Arg arg; 67 }; 68 69 typedef struct client { 70 struct client *next, *prev; 71 int f, wx, wy; 72 unsigned int ww, wh; 73 Window w; 74 } client; 75 76 unsigned long getcolor(const char *col); 77 void button_press(XEvent *e); 78 void button_release(XEvent *e); 79 void configure_request(XEvent *e); 80 void input_grab(Window root); 81 void key_press(XEvent *e); 82 void map_request(XEvent *e); 83 void mapping_notify(XEvent *e); 84 void notify_destroy(XEvent *e); 85 void notify_enter(XEvent *e); 86 void notify_motion(XEvent *e); 87 void run(const Arg arg); 88 void runAutoStart(void); 89 void win_add(Window w); 90 void win_center(const Arg arg); 91 void win_del(Window w); 92 void win_fs(const Arg arg); 93 void win_focus(client *c); 94 void win_kill(const Arg arg); 95 void win_prev(const Arg arg); 96 void win_next(const Arg arg); 97 void win_to_ws(const Arg arg); 98 void ws_go(const Arg arg); 99 void create_bar(); 100 void update_bar(); 101 void draw_text(const char *text, int x, int y); 102 void create_systray(); 103 void handle_systray_request(XClientMessageEvent *cme); 104 void update_systray(); 105 void run_nyxwmblocks(); 106 void handle_destroy_notify(XDestroyWindowEvent *ev); 107 int xerror(Display *dpy, XErrorEvent *ee); 108 109 extern Window bar; 110 extern XftFont *xft_font; 111 extern XftColor xft_color; 112 extern XftDraw *xft_draw; 113 extern Window systray; 114 extern Window systray_icons[MAX_SYSTRAY_ICONS]; 115 extern int num_systray_icons; 116 extern Atom xembed_atom; 117 extern Atom manager_atom; 118 extern Atom system_tray_opcode_atom; 119 extern Atom system_tray_selection_atom; 120 121 #endif