summaryrefslogtreecommitdiff
path: root/src/defs.h
blob: 373cfeebc9631bdf5ec3f618c9e0eb7a95a0a651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* See LICENSE for more information on use */

#ifndef DEFS_H
#define DEFS_H

#include <X11/Xlib.h>

#define uint unsigned int
#define ulong unsigned long
#define u_char unsigned char

#define SXWM_VERSION	"sxwm ver. 1.1.1"
#define SXWM_AUTHOR		"(C) Abhinav Prasai 2025"
#define SXWM_LICINFO	"See LICENSE for more info"

#define ALT		Mod1Mask
#define SUPER	Mod4Mask
#define SHIFT	ShiftMask

#define MARGIN (gaps + BORDER_WIDTH)
#define OUT_IN (2 * BORDER_WIDTH)
#define MF_MIN 0.05f
#define MF_MAX 0.95f
#define LENGTH(X) (sizeof X / sizeof X[0])
#define BIND(mod, key, cmdstr) { (mod), XK_##key, { cmdstr }, False }
#define CALL(mod, key, fnptr) { (mod), XK_##key, { .fn = fnptr }, True }
#define CMD(name, ...) 						\
	const char *name[] = { __VA_ARGS__, NULL }


#define INIT_WORKSPACE \
void change_ws1(void);\
void moveto_ws1(void);\
void change_ws2(void);\
void moveto_ws2(void);\
void change_ws3(void);\
void moveto_ws3(void);\
void change_ws4(void);\
void moveto_ws4(void);\
void change_ws5(void);\
void moveto_ws5(void);\
void change_ws6(void);\
void moveto_ws6(void);\
void change_ws7(void);\
void moveto_ws7(void);\
void change_ws8(void);\
void moveto_ws8(void);\
void change_ws9(void);\
void moveto_ws9(void);\
void change_ws1(void) { change_workspace(0); update_net_client_list(); }	\
void moveto_ws1(void) { move_to_workspace(0); update_net_client_list(); }\
void change_ws2(void) { change_workspace(1); update_net_client_list(); }	\
void moveto_ws2(void) { move_to_workspace(1); update_net_client_list(); }\
void change_ws3(void) { change_workspace(2); update_net_client_list(); }	\
void moveto_ws3(void) { move_to_workspace(2); update_net_client_list(); }\
void change_ws4(void) { change_workspace(3); update_net_client_list(); }	\
void moveto_ws4(void) { move_to_workspace(3); update_net_client_list(); }\
void change_ws5(void) { change_workspace(4); update_net_client_list(); }	\
void moveto_ws5(void) { move_to_workspace(4); update_net_client_list(); }\
void change_ws6(void) { change_workspace(5); update_net_client_list(); }	\
void moveto_ws6(void) { move_to_workspace(5); update_net_client_list(); }\
void change_ws7(void) { change_workspace(6); update_net_client_list(); }	\
void moveto_ws7(void) { move_to_workspace(6); update_net_client_list(); }\
void change_ws8(void) { change_workspace(7); update_net_client_list(); }	\
void moveto_ws8(void) { move_to_workspace(7); update_net_client_list(); }\
void change_ws9(void) { change_workspace(8); update_net_client_list(); }	\
void moveto_ws9(void) { move_to_workspace(8); update_net_client_list(); }\

#define UDIST(a,b) abs((int)(a) - (int)(b))
#define MAXCLIENTS	99
#define MAXGAPS		100

typedef enum {
	DRAG_NONE,
	DRAG_MOVE,
	DRAG_RESIZE,
	DRAG_SWAP
} DragMode;

typedef void (*EventHandler)(XEvent *);

typedef union {
	const char **cmd;
	void (*fn)(void);
} Action;

typedef struct {
	unsigned int mods;
	KeySym keysym;
	Action action;
	Bool is_func;
} Binding;

typedef struct Client{
	Window win;
	uint x, y, h, w;
	uint orig_x, orig_y, orig_w, orig_h;
	int mon;
	Bool fixed;
	Bool floating;
	Bool fullscreen;
	struct Client *next;
} Client;

typedef struct {
	uint gaps;
	uint border_width;
	ulong border_foc_col;
	ulong border_ufoc_col;
	ulong border_swap_col;
	uint master_width;
	uint resize_master_amt;
	uint snap_distance;
	Binding *binds;
} Config;

typedef struct {
	int x, y;
	uint w, h;
} Monitor;

#endif