aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile116
-rw-r--r--README.md48
-rw-r--r--src/config/config.mk40
-rw-r--r--src/core/dwm.c4
-rw-r--r--src/core/dwm.h2
-rw-r--r--src/core/globals.h21
-rw-r--r--src/core/types.h158
-rw-r--r--src/drw/drw.c2
-rw-r--r--src/drw/drw.h1
-rw-r--r--src/transient/transient.c90
-rw-r--r--src/ui/bar.h13
-rw-r--r--src/ui/input.h13
-rw-r--r--src/ui/systray.h12
-rw-r--r--src/util/util.c4
-rw-r--r--src/util/util.h4
-rw-r--r--src/wm/client.h26
-rw-r--r--src/wm/layout.h12
-rw-r--r--src/wm/monitor.h15
-rw-r--r--src/x11/xevents.h25
-rw-r--r--src/x11/xutil.h21
21 files changed, 440 insertions, 190 deletions
diff --git a/.gitignore b/.gitignore
index 6af4514..e984b67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
4patches 4patches
5*.o 5*.o
6dwm 6dwm
7 7*.d
8.idea/
diff --git a/Makefile b/Makefile
index ad5119d..84c0b68 100644
--- a/Makefile
+++ b/Makefile
@@ -1,46 +1,95 @@
1# dwm - dynamic window manager 1# =========================
2# See LICENSE file for copyright and license details. 2# config
3# =========================
3 4
4include src/config/config.mk 5PREFIX = /usr/local
6MANPREFIX = ${PREFIX}/share/man
5 7
6SRC = src/drw/drw.c src/core/dwm.c src/util/util.c 8X11INC = /usr/X11R6/include
7OBJ = $(SRC:.c=.o) 9X11LIB = /usr/X11R6/lib
8 10
9CFLAGS += -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os \ 11FREETYPEINC = /usr/include/freetype2
10 -I/usr/X11R6/include \ 12FREETYPELIBS= -lfontconfig -lXft
11 -I/usr/include/freetype2 \ 13
12 -I./src/util \ 14XINERAMAFLAGS = -DXINERAMA
15XINERAMALIBS = -lXinerama
16
17# =========================
18# flags
19# =========================
20
21INCS = \
22 -I${X11INC} \
23 -I${FREETYPEINC} \
24 -I./src \
13 -I./src/drw \ 25 -I./src/drw \
14 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L \ 26 -I./src/util
15 -DVERSION=\"6.4\" -DXINERAMA 27
28CPPFLAGS = \
29 -D_DEFAULT_SOURCE \
30 -D_BSD_SOURCE \
31 -D_XOPEN_SOURCE=700L \
32 -DVERSION=\"${VERSION}\" \
33 ${XINERAMAFLAGS}
34
35CFLAGS = \
36 -std=c99 \
37 -pedantic \
38 -Wall \
39 -Wno-deprecated-declarations \
40 -Os \
41 ${INCS} \
42 ${CPPFLAGS}
43
44LDFLAGS = \
45 -L${X11LIB} \
46 -lX11 \
47 ${XINERAMALIBS} \
48 ${FREETYPELIBS} \
49 -lX11-xcb \
50 -lxcb \
51 -lxcb-res
52
53CC = clang
54
55# =========================
56# sources
57# =========================
58
59SRC = \
60 src/core/dwm.c \
61 src/drw/drw.c \
62 src/util/util.c
63 # src/core/globals.c \
64 # src/x11/xevents.c \
65 # src/x11/xutil.c \
66 # src/wm/client.c \
67 # src/wm/monitor.c \
68 # src/wm/layout.c \
69 # src/ui/input.c \
70 # src/ui/bar.c \
71 # src/ui/systray.c \
16 72
17LDFLAGS += -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lX11-xcb -lxcb -lxcb-res 73
74OBJ = ${SRC:.c=.o}
75
76# =========================
77# build rules
78# =========================
18 79
19all: dwm 80all: dwm
20 81
21%.o: %.c 82%.o: %.c
22 ${CC} -c ${CFLAGS} -o $@ $< 83 ${CC} -c ${CFLAGS} -o $@ $<
23 84
24${OBJ}: src/config/config.h src/config/config.mk
25
26config.h:
27 cp src/config/config.def.h $@
28
29dwm: ${OBJ} 85dwm: ${OBJ}
30 ${CC} -o $@ ${OBJ} ${LDFLAGS} 86 ${CC} -o $@ ${OBJ} ${LDFLAGS}
31 87
32clean: 88# =========================
33 rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz 89# install
90# =========================
34 91
35dist: clean 92install: dwm
36 mkdir -p dwm-${VERSION}
37 cp -R LICENSE Makefile README src/config/config.def.h src/config/config.mk \
38 src/core/dwm.1 src/drw/drw.h src/util/util.h ${SRC} /assets/dwm.png src/transient/transient.c dwm-${VERSION}
39 tar -cf dwm-${VERSION}.tar dwm-${VERSION}
40 gzip dwm-${VERSION}.tar
41 rm -rf dwm-${VERSION}
42
43install: all
44 mkdir -p ${DESTDIR}${PREFIX}/bin 93 mkdir -p ${DESTDIR}${PREFIX}/bin
45 cp -f dwm ${DESTDIR}${PREFIX}/bin 94 cp -f dwm ${DESTDIR}${PREFIX}/bin
46 chmod 755 ${DESTDIR}${PREFIX}/bin/dwm 95 chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
@@ -50,6 +99,13 @@ install: all
50 99
51uninstall: 100uninstall:
52 rm -f ${DESTDIR}${PREFIX}/bin/dwm \ 101 rm -f ${DESTDIR}${PREFIX}/bin/dwm \
53 ${DESTDIR}${MANPREFIX}/man1/dwm.1 102 ${DESTDIR}${MANPREFIX}/man1/dwm.1
103
104# =========================
105# housekeeping
106# =========================
107
108clean:
109 rm -f dwm ${OBJ}
54 110
55.PHONY: all clean dist install uninstall 111.PHONY: all clean install uninstall
diff --git a/README.md b/README.md
index 15a362f..c72d929 100644
--- a/README.md
+++ b/README.md
@@ -1,42 +1,48 @@
1## Installation 1## Installation
2------------
3Edit config.mk to match your local setup (dwm is installed into
4the /usr/local namespace by default).
5 2
6Afterwards enter the following command to build and install dwm (if 3Hit command below in the root dir
7necessary as root):
8 4
9```bash 5```bash
10 make clean install 6 make clean install
11``` 7```
12 8
13## Running dwm 9Or if you use arch-based distro and like pacman
14Add the following line to your .xinitrc to start dwm using startx: 10
15```bash 11```bash
16 exec dwm 12 makepkg -si
17``` 13```
18 14
19In order to connect dwm to a specific display, make sure that 15## Execution
20the DISPLAY environment variable is set correctly, e.g.: 16
17Probably the best way is to use your xinitrc config file and do something like
21 18
22```bash 19```bash
23 DISPLAY=foo.bar:1 exec dwm 20 dbus-run-session dwm
24``` 21```
25In order to display status info in the bar, you can do something 22
26like this in your .xinitrc: 23If you fancy having system stuff in your status bar you need to do something like this or use your own **better**
24statusbar.
27 25
28```bash 26```bash
29 while xsetroot -name "`date` `uptime | sed 's/.*,//'`" 27while
30 do 28 mem_used=$(free -h | awk '/^Mem:/ {print $3}')
31 sleep 1 29 cpu_load=$(top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4"%"}')
32 done & 30 battery_capacity=$(cat /sys/class/power_supply/BAT0/capacity)
33 exec dwm 31 volume_level=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
32 disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2}')
33
34 xsetroot -name "$volume_level | Btr: $battery_capacity% | RAM: $mem_used | CPU: $cpu_load | Disk: $disk_usage | $(date '+%d.%m.%Y (%a) %T')"
35do
36 sleep 5
37done &
38
34``` 39```
35 40
36## Configuration 41## Configuration
37The configuration of dwm is done by creating a custom config.h 42
38and (re)compiling the source code. 43You can customize looks via `Xresources` and keybindings via `config.h`. After you're done hit `super` + `r` to restart
44the dwm process.
39 45
40## Additional resources 46## Additional resources
41 47
42Restart patch pulled from (gist.github.org/bpsuntrup)[bpsuntrup's gist] 48Swallow, Xresources, Gaps, Systray pulled from [suckless.org](https://dwm.suckless.org/patches/)
diff --git a/src/config/config.mk b/src/config/config.mk
deleted file mode 100644
index f8dab1b..0000000
--- a/src/config/config.mk
+++ /dev/null
@@ -1,40 +0,0 @@
1# dwm version
2VERSION = 6.4
3
4# Customize below to fit your system
5
6# paths
7PREFIX = /usr/local
8MANPREFIX = ${PREFIX}/share/man
9
10X11INC = /usr/X11R6/include
11X11LIB = /usr/X11R6/lib
12
13# Xinerama, comment if you don't want it
14XINERAMALIBS = -lXinerama
15XINERAMAFLAGS = -DXINERAMA
16
17# freetype
18FREETYPELIBS = -lfontconfig -lXft
19FREETYPEINC = /usr/include/freetype2
20# OpenBSD (uncomment)
21#FREETYPEINC = ${X11INC}/freetype2
22#MANPREFIX = ${PREFIX}/man
23#KVMLIB = -lkvm
24
25# includes and libs
26INCS = -I${X11INC} -I${FREETYPEINC}
27LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB}
28
29# flags
30CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
31#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
32CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
33LDFLAGS = ${LIBS}
34
35# Solaris
36#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
37#LDFLAGS = ${LIBS}
38
39# compiler and linker
40CC = tcc
diff --git a/src/core/dwm.c b/src/core/dwm.c
index cd7fdb0..6d4cdcd 100644
--- a/src/core/dwm.c
+++ b/src/core/dwm.c
@@ -851,7 +851,7 @@ Atom getatomprop(Client *c, Atom prop)
851 return atom; 851 return atom;
852} 852}
853 853
854unsigned int getsystraywidth() 854unsigned int getsystraywidth(void)
855{ 855{
856 unsigned int w = 0; 856 unsigned int w = 0;
857 Client *i; 857 Client *i;
@@ -1970,7 +1970,7 @@ void updatebarpos(Monitor *m)
1970 m->by = -bh; 1970 m->by = -bh;
1971} 1971}
1972 1972
1973void updateclientlist() 1973void updateclientlist(void)
1974{ 1974{
1975 Client *c; 1975 Client *c;
1976 Monitor *m; 1976 Monitor *m;
diff --git a/src/core/dwm.h b/src/core/dwm.h
index 273645a..d3bdf5a 100644
--- a/src/core/dwm.h
+++ b/src/core/dwm.h
@@ -153,7 +153,7 @@ static void focusin(XEvent *e);
153static Atom getatomprop(Client *c, Atom prop); 153static Atom getatomprop(Client *c, Atom prop);
154static int getrootptr(int *x, int *y); 154static int getrootptr(int *x, int *y);
155static long getstate(Window w); 155static long getstate(Window w);
156static unsigned int getsystraywidth(); 156static unsigned int getsystraywidth(void);
157static int gettextprop(Window w, Atom atom, char *text, unsigned int size); 157static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
158static void grabbuttons(Client *c, int focused); 158static void grabbuttons(Client *c, int focused);
159static void grabkeys(void); 159static void grabkeys(void);
diff --git a/src/core/globals.h b/src/core/globals.h
new file mode 100644
index 0000000..4b800fe
--- /dev/null
+++ b/src/core/globals.h
@@ -0,0 +1,21 @@
1
2#pragma once
3
4#include "types.h"
5
6extern Display *dpy;
7extern Window root, wmcheckwin;
8
9extern Monitor *mons, *selmon;
10
11extern int screen;
12extern int sw, sh;
13extern int bh;
14extern int running;
15extern unsigned int numlockmask;
16
17extern Atom wmatom[WMLast];
18extern Atom netatom[NetLast];
19extern Atom xatom[XLast];
20
21extern Systray *systray;
diff --git a/src/core/types.h b/src/core/types.h
new file mode 100644
index 0000000..dc10fc0
--- /dev/null
+++ b/src/core/types.h
@@ -0,0 +1,158 @@
1
2#pragma once
3
4#include <X11/Xatom.h>
5#include <X11/Xlib.h>
6#include <sys/types.h>
7
8/* cursors */
9enum { CurNormal, CurResize, CurMove, CurLast };
10
11/* color schemes */
12enum { SchemeNorm, SchemeSel };
13
14/* EWMH atoms */
15enum {
16 NetSupported,
17 NetWMName,
18 NetWMState,
19 NetWMCheck,
20 NetSystemTray,
21 NetSystemTrayOP,
22 NetSystemTrayOrientation,
23 NetSystemTrayOrientationHorz,
24 NetWMFullscreen,
25 NetActiveWindow,
26 NetWMWindowType,
27 NetWMWindowTypeDialog,
28 NetClientList,
29 NetLast
30};
31
32/* XEmbed */
33enum { Manager, Xembed, XembedInfo, XLast };
34
35/* ICCCM */
36enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast };
37
38/* clicks */
39enum {
40 ClkTagBar,
41 ClkLtSymbol,
42 ClkStatusText,
43 ClkWinTitle,
44 ClkClientWin,
45 ClkRootWin,
46 ClkLast
47};
48
49/* generic argument */
50typedef union {
51 int i;
52 unsigned int ui;
53 float f;
54 const void *v;
55} Arg;
56
57/* input */
58typedef struct {
59 unsigned int click;
60 unsigned int mask;
61 unsigned int button;
62 void (*func)(const Arg *arg);
63 const Arg arg;
64} Button;
65
66typedef struct {
67 unsigned int mod;
68 KeySym keysym;
69 void (*func)(const Arg *);
70 const Arg arg;
71} Key;
72
73/* forward decls */
74typedef struct Client Client;
75typedef struct Monitor Monitor;
76
77/* layout */
78typedef struct {
79 const char *symbol;
80 void (*arrange)(Monitor *);
81} Layout;
82
83/* client */
84struct Client {
85 char name[256];
86
87 float mina, maxa;
88 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
89 int hintsvalid;
90
91 int x, y, w, h;
92 int oldx, oldy, oldw, oldh;
93 int bw, oldbw;
94
95 unsigned int tags;
96 int isfixed, isfloating, isurgent, neverfocus;
97 int oldstate, isfullscreen;
98 int isterminal, noswallow;
99
100 pid_t pid;
101
102 Client *next;
103 Client *snext;
104 Client *swallowing;
105
106 Monitor *mon;
107 Window win;
108};
109
110/* monitor */
111struct Monitor {
112 char ltsymbol[16];
113
114 float mfact;
115 int nmaster;
116 int num;
117
118 int mx, my, mw, mh;
119 int wx, wy, ww, wh;
120 int by;
121
122 int gappih, gappiv;
123 int gappoh, gappov;
124
125 unsigned int seltags;
126 unsigned int sellt;
127 unsigned int tagset[2];
128
129 int showbar;
130 int topbar;
131
132 Client *clients;
133 Client *sel;
134 Client *stack;
135
136 Monitor *next;
137 Window barwin;
138
139 const Layout *lt[2];
140};
141
142/* rules */
143typedef struct {
144 const char *class;
145 const char *instance;
146 const char *title;
147 unsigned int tags;
148 int isfloating;
149 int isterminal;
150 int noswallow;
151 int monitor;
152} Rule;
153
154/* systray */
155typedef struct Systray {
156 Window win;
157 Client *icons;
158} Systray;
diff --git a/src/drw/drw.c b/src/drw/drw.c
index 05420c0..5e90c2c 100644
--- a/src/drw/drw.c
+++ b/src/drw/drw.c
@@ -111,7 +111,7 @@ static Fnt *xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
111 /* Using the pattern found at font->xfont->pattern does not 111 /* Using the pattern found at font->xfont->pattern does not
112 * yield the same substitution results as using the pattern 112 * yield the same substitution results as using the pattern
113 * returned by FcNameParse; using the latter results in the 113 * returned by FcNameParse; using the latter results in the
114 * desired fallback behaviour whereas the former just results in 114 * desired fallback behavior whereas the former just results in
115 * missing-character rectangles being drawn, at least with some 115 * missing-character rectangles being drawn, at least with some
116 * fonts. */ 116 * fonts. */
117 if (!(xfont = 117 if (!(xfont =
diff --git a/src/drw/drw.h b/src/drw/drw.h
index 88308ab..e1c91ae 100644
--- a/src/drw/drw.h
+++ b/src/drw/drw.h
@@ -1,5 +1,6 @@
1/* See LICENSE file for copyright and license details. */ 1/* See LICENSE file for copyright and license details. */
2 2
3#include <X11/Xft/Xft.h>
3typedef struct { 4typedef struct {
4 Cursor cursor; 5 Cursor cursor;
5} Cur; 6} Cur;
diff --git a/src/transient/transient.c b/src/transient/transient.c
deleted file mode 100644
index fed0f77..0000000
--- a/src/transient/transient.c
+++ /dev/null
@@ -1,90 +0,0 @@
1#include <X11/Xlib.h>
2#include <X11/Xutil.h>
3#include <stdlib.h>
4#include <unistd.h>
5
6#define FLOATING_WINDOW_WIDTH 400
7#define FLOATING_WINDOW_HEIGHT 400
8#define FLOATING_WINDOW_X_POS 100
9#define FLOATING_WINDOW_Y_POS 100
10
11#define TRANSIENT_WINDOW_WIDTH 100
12#define TRANSIENT_WINDOW_HEIGHT 100
13#define TRANSIENT_WINDOW_X_POS 50
14#define TRANSIENT_WINDOW_Y_POS 50
15
16#define SLEEP_TIME 5
17
18#define WINDOW_BORDER_WIDTH 0
19#define WINDOW_BORDER_COLOR 0
20#define WINDOW_BACKGROUND_COLOR 0
21
22/**
23 * @brief Function that creates and manages floating and transient window.
24 *
25 * This program opens an X display, creates a floating window with specific
26 * size and position, and then creates a transient (child) window after a
27 * specified delay. The transient window is always associated with the
28 * floating window, meaning it will behave as a child of the floating window.
29 * The program uses Xlib to interact with the X server, handle events, and
30 * manage window properties such as size, title, and position.
31 *
32 * The key steps are:
33 * 1. Create the floating window and set its size constraints.
34 * 2. After a delay (5 seconds), create the transient window and associate
35 * it with the floating window.
36 * 3. Display both windows on the screen.
37 * 4. Wait for and process X events in an infinite loop. This allows the
38 * windows to remain open and interact with the X server.
39 *
40 * @return int Exit status (always 0).
41 */
42int main(void)
43{
44 Display *display;
45 Window rootWindow, floatingWindow, transientWindow = None;
46 XSizeHints sizeHints;
47 XEvent event;
48
49 display = XOpenDisplay(NULL);
50 if (!display)
51 exit(1);
52
53 rootWindow = DefaultRootWindow(display);
54
55 floatingWindow = XCreateSimpleWindow(
56 display, rootWindow, FLOATING_WINDOW_X_POS, FLOATING_WINDOW_Y_POS,
57 FLOATING_WINDOW_WIDTH, FLOATING_WINDOW_HEIGHT, WINDOW_BORDER_WIDTH,
58 WINDOW_BORDER_COLOR, WINDOW_BACKGROUND_COLOR);
59
60 sizeHints.min_width = sizeHints.max_width = sizeHints.min_height =
61 sizeHints.max_height = FLOATING_WINDOW_WIDTH;
62 sizeHints.flags = PMinSize | PMaxSize;
63 XSetWMNormalHints(display, floatingWindow, &sizeHints);
64 XStoreName(display, floatingWindow, "floating");
65 XMapWindow(display, floatingWindow);
66 XSelectInput(display, floatingWindow, ExposureMask);
67
68 while (1) {
69 XNextEvent(display, &event);
70
71 if (transientWindow == None) {
72 sleep(SLEEP_TIME);
73
74 transientWindow = XCreateSimpleWindow(
75 display, rootWindow, TRANSIENT_WINDOW_X_POS,
76 TRANSIENT_WINDOW_Y_POS, TRANSIENT_WINDOW_WIDTH,
77 TRANSIENT_WINDOW_HEIGHT, WINDOW_BORDER_WIDTH,
78 WINDOW_BORDER_COLOR, WINDOW_BACKGROUND_COLOR);
79
80 XSetTransientForHint(display, transientWindow,
81 floatingWindow);
82 XStoreName(display, transientWindow, "transient");
83 XMapWindow(display, transientWindow);
84 XSelectInput(display, transientWindow, ExposureMask);
85 }
86 }
87
88 XCloseDisplay(display);
89 exit(0);
90}
diff --git a/src/ui/bar.h b/src/ui/bar.h
new file mode 100644
index 0000000..79e4912
--- /dev/null
+++ b/src/ui/bar.h
@@ -0,0 +1,13 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void drawbar(Monitor *m);
7void drawbars(void);
8void updatebars(void);
9void updatestatus(void);
10unsigned int getsystraywidth(void);
11
12extern char stext[256];
13extern int lrpad;
diff --git a/src/ui/input.h b/src/ui/input.h
new file mode 100644
index 0000000..54e3c58
--- /dev/null
+++ b/src/ui/input.h
@@ -0,0 +1,13 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void grabkeys(void);
7void grabbuttons(Client *c, int focused);
8
9void keypress(XEvent *e);
10void buttonpress(XEvent *e);
11
12void movemouse(const Arg *arg);
13void resizemouse(const Arg *arg);
diff --git a/src/ui/systray.h b/src/ui/systray.h
new file mode 100644
index 0000000..ad78f58
--- /dev/null
+++ b/src/ui/systray.h
@@ -0,0 +1,12 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void updatesystray(void);
7void removesystrayicon(Client *i);
8void updatesystrayicongeom(Client *i, int w, int h);
9void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
10
11Client *wintosystrayicon(Window w);
12Monitor *systraytomon(Monitor *m);
diff --git a/src/util/util.c b/src/util/util.c
index 61c864c..7938f0f 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -54,11 +54,11 @@ void die(const char *format_string, ...)
54 * int *array = ecalloc(10, sizeof(int)); // Allocate memory for an array of 54 * int *array = ecalloc(10, sizeof(int)); // Allocate memory for an array of
55 * 10 integers. 55 * 10 integers.
56 */ 56 */
57void *ecalloc(size_t num_elements, size_t element_size) 57void *ecalloc(const size_t num_elements, const size_t element_size)
58{ 58{
59 void *allocated_memory; 59 void *allocated_memory;
60 60
61 if (!(allocated_memory = calloc(num_elements, element_size))) 61 if (!((allocated_memory = calloc(num_elements, element_size))))
62 die("calloc:"); 62 die("calloc:");
63 63
64 return allocated_memory; 64 return allocated_memory;
diff --git a/src/util/util.h b/src/util/util.h
index 6ef3c86..2c2f773 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -35,7 +35,7 @@
35 * Usage: 35 * Usage:
36 * die("Error occurred in function %s", __func__); 36 * die("Error occurred in function %s", __func__);
37 */ 37 */
38void die(const char *fmt, ...); 38void die(const char *format_string, ...);
39 39
40/* 40/*
41 * ecalloc() 41 * ecalloc()
@@ -56,4 +56,4 @@ void die(const char *fmt, ...);
56 * int *arr = ecalloc(10, sizeof(int)); // Allocate memory for an array of 10 56 * int *arr = ecalloc(10, sizeof(int)); // Allocate memory for an array of 10
57 * integers. 57 * integers.
58 */ 58 */
59void *ecalloc(size_t nmemb, size_t size); 59void *ecalloc(size_t num_elements, size_t element_size);
diff --git a/src/wm/client.h b/src/wm/client.h
new file mode 100644
index 0000000..8a2a05e
--- /dev/null
+++ b/src/wm/client.h
@@ -0,0 +1,26 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void manage(Window w, XWindowAttributes *wa);
7void unmanage(Client *c, int destroyed);
8
9void attach(Client *c);
10void detach(Client *c);
11void attachstack(Client *c);
12void detachstack(Client *c);
13
14void focus(Client *c);
15void unfocus(Client *c, int setfocus);
16
17void resize(Client *c, int x, int y, int w, int h, int interact);
18void resizeclient(Client *c, int x, int y, int w, int h);
19
20Client *nexttiled(Client *c);
21Client *wintoclient(Window w);
22
23/* swallow (optional) */
24Client *swallowingclient(Window w);
25Client *termforwin(const Client *c);
26pid_t winpid(Window w);
diff --git a/src/wm/layout.h b/src/wm/layout.h
new file mode 100644
index 0000000..5deab64
--- /dev/null
+++ b/src/wm/layout.h
@@ -0,0 +1,12 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void arrange(Monitor *m);
7void arrangemon(Monitor *m);
8void tile(Monitor *m);
9void restack(Monitor *m);
10void showhide(Client *c);
11void zoom(const Arg *arg);
12void setlayout(const Arg *arg);
diff --git a/src/wm/monitor.h b/src/wm/monitor.h
new file mode 100644
index 0000000..e09935e
--- /dev/null
+++ b/src/wm/monitor.h
@@ -0,0 +1,15 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6Monitor *createmon(void);
7void cleanupmon(Monitor *mon);
8
9Monitor *recttomon(int x, int y, int w, int h);
10Monitor *wintomon(Window w);
11void sendmon(Client *c, Monitor *m);
12
13int updategeom(void);
14void updatebarpos(Monitor *m);
15void resizebarwin(Monitor *m);
diff --git a/src/x11/xevents.h b/src/x11/xevents.h
new file mode 100644
index 0000000..98129bb
--- /dev/null
+++ b/src/x11/xevents.h
@@ -0,0 +1,25 @@
1
2#pragma once
3
4#include <X11/Xlib.h>
5
6void run(void);
7void scan(void);
8
9void buttonpress(XEvent *e);
10void keypress(XEvent *e);
11void maprequest(XEvent *e);
12void configurerequest(XEvent *e);
13void configurenotify(XEvent *e);
14void destroynotify(XEvent *e);
15void unmapnotify(XEvent *e);
16void clientmessage(XEvent *e);
17void propertynotify(XEvent *e);
18void resizerequest(XEvent *e);
19void mappingnotify(XEvent *e);
20void motionnotify(XEvent *e);
21void enternotify(XEvent *e);
22void focusin(XEvent *e);
23void expose(XEvent *e);
24
25extern void (*handler[LASTEvent])(XEvent *);
diff --git a/src/x11/xutil.h b/src/x11/xutil.h
new file mode 100644
index 0000000..2e044e3
--- /dev/null
+++ b/src/x11/xutil.h
@@ -0,0 +1,21 @@
1
2#pragma once
3
4#include "../core/types.h"
5
6void checkotherwm(void);
7
8Atom getatomprop(Client *c, Atom prop);
9int getrootptr(int *x, int *y);
10long getstate(Window w);
11int gettextprop(Window w, Atom atom, char *text, unsigned int size);
12
13int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3,
14 long d4);
15
16void setfocus(Client *c);
17void updatenumlockmask(void);
18
19int xerror(Display *dpy, XErrorEvent *ee);
20int xerrordummy(Display *dpy, XErrorEvent *ee);
21int xerrorstart(Display *dpy, XErrorEvent *ee);