Compare commits

..

No commits in common. "master" and "0.3" have entirely different histories.
master ... 0.3

7 changed files with 328 additions and 222 deletions

View File

@ -1,24 +1,21 @@
CFLAGS += -std=c99 -Wall -Wextra -pedantic -Wold-style-declaration
CFLAGS += -Wmissing-prototypes -Wno-unused-parameter
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
CFLAGS+= -std=c99 -Wall -Wextra -pedantic -Wno-deprecated-declarations
LDADD+= -lX11
LDFLAGS=
PREFIX?= /usr
BINDIR?= $(PREFIX)/bin
CC ?= gcc
all: sowm
all: config.h sowm
config.h:
cp config.def.h config.h
sowm: sowm.c sowm.h config.h Makefile
$(CC) -O3 $(CFLAGS) -o $@ $< -lX11 $(LDFLAGS)
sowm: sowm.o
$(CC) $(LDFLAGS) -O3 -o $@ $+ $(LDADD)
install: all
install -Dm755 sowm $(DESTDIR)$(BINDIR)/sowm
uninstall:
rm -f $(DESTDIR)$(BINDIR)/sowm
install -Dm 755 sowm $(DESTDIR)$(BINDIR)/sowm
clean:
rm -f sowm *.o
.PHONY: all install uninstall clean

View File

@ -1,16 +1,15 @@
# sowm (*~~Simple~~ Shitty Opinionated Window Manager*)
# sowm
<a href="https://user-images.githubusercontent.com/6799467/66687576-9747c200-ec72-11e9-947d-5b96753eab03.jpg"><img src="https://user-images.githubusercontent.com/6799467/66687576-9747c200-ec72-11e9-947d-5b96753eab03.jpg" width="43%" align="right"></a>
An itsy bitsy floating window manager (*220~ sloc!*).
An itsy bitsy floating window manager (*240~ sloc / 24kb compiled!*).
- Floating only.
- Fullscreen toggle.
- Window centering.
- Mix of mouse and keyboard workflow.
- Focus with cursor.
- Rounded corners (*[through patch](https://github.com/dylanaraps/sowm/pull/58)*)
- Titlebars (*[through patch](https://github.com/dylanaraps/sowm/pull/57)*)
- Rounded corners (*[through patch](https://github.com/dylanaraps/sowm/blob/master/patches/sowm-rounded-corners.patch)*)
<a href="https://user-images.githubusercontent.com/6799467/66687814-8cd9f800-ec73-11e9-97b8-6ae77876bd1b.jpg"><img src="https://user-images.githubusercontent.com/6799467/66687814-8cd9f800-ec73-11e9-97b8-6ae77876bd1b.jpg" width="43%" align="right"></a>
@ -18,14 +17,12 @@ An itsy bitsy floating window manager (*220~ sloc!*).
- All windows die on exit.
- No window borders.
- [No ICCCM](https://web.archive.org/web/20190617214524/https://raw.githubusercontent.com/kfish/xsel/1a1c5edf0dc129055f7764c666da2dd468df6016/rant.txt).
- No EWMH.
- No EMWH.
- etc etc etc
<br>
Patches available here: https://github.com/dylanaraps/sowm/pulls
## Default Keybindings
**Window Management**
@ -38,8 +35,8 @@ Patches available here: https://github.com/dylanaraps/sowm/pulls
| `MOD4` + `f` | maximize toggle |
| `MOD4` + `c` | center window |
| `MOD4` + `q` | kill window |
| `MOD4` + `1-6` | desktop swap |
| `MOD4` + `Shift` +`1-6` | send window to desktop |
| `MOD4` + `1-9` | desktop swap |
| `MOD4` + `Shift` +`1-9` | send window to desktop |
| `MOD1` + `TAB` (*alt-tab*) | focus cycle |
**Programs**
@ -68,31 +65,18 @@ Patches available here: https://github.com/dylanaraps/sowm/pulls
2) Run `make` to build `sowm`.
3) Copy it to your path or run `make install`.
- `DESTDIR` and `PREFIX` are supported.
4) (Optional) Apply patch with `git apply patches/patch-name`
- In case of applying multiple patches, it has to be done **manually**.
If you are using GDM, save the following to `/usr/share/xsessions/sowm.desktop`. It is still recommended to start `sowm` from `.xinitrc` or through
[your own xinit implementation](https://github.com/dylanaraps/bin/blob/dfd9a9ff4555efb1cc966f8473339f37d13698ba/x).
```
[Desktop Entry]
Name=sowm
Comment=This session runs sowm as desktop manager
Exec=sowm
Type=Application
```
## Thanks
- [2bwm](https://github.com/venam/2bwm)
- [SmallWM](https://github.com/adamnew123456/SmallWM)
- [berry](https://github.com/JLErvin/berry)
- [catwm](https://github.com/pyknite/catwm)
- [dminiwm](https://github.com/moetunes/dminiwm)
- [dwm](https://dwm.suckless.org)
- [monsterwm](https://github.com/c00kiemon5ter/monsterwm)
- [openbox](https://github.com/danakj/openbox)
- [possum-wm](https://github.com/duckinator/possum-wm)
- [swm](https://github.com/dcat/swm)
- [tinywm](http://incise.org/tinywm.html)
- 2bwm
- SmallWM
- berry
- catwm
- dminiwm
- dwm
- monsterwm
- openbox
- possumwm
- swm
- tinywm

View File

@ -15,11 +15,9 @@ const char* colors[] = {"bud", "/home/goldie/Pictures/Wallpapers", 0};
static struct key keys[] = {
{MOD, XK_q, win_kill, {0}},
{MOD, XK_c, win_center, {0}},
{MOD, XK_c, win_center, {.w = 0}},
{MOD, XK_f, win_fs, {0}},
{Mod1Mask, XK_Tab, win_next, {0}},
{Mod1Mask|ShiftMask, XK_Tab, win_prev, {0}},
{MOD, XK_d, run, {.com = menu}},
{MOD, XK_w, run, {.com = colors}},

View File

@ -0,0 +1,51 @@
diff --git a/patches/sowm-normal-kill.patch b/patches/sowm-normal-kill.patch
index 4b11cd4..e69de29 100644
--- a/patches/sowm-normal-kill.patch
+++ b/patches/sowm-normal-kill.patch
@@ -1,23 +0,0 @@
-diff --git a/sowm.c b/sowm.c
-index 0d74d4b..ff70968 100644
---- a/sowm.c
-+++ b/sowm.c
-@@ -326,7 +326,17 @@ void win_del(Window w) {
- "Shoot first and don't ask questions later?.."
- */
- void win_kill() {
-- if (win_current() != root) XKillClient(d, cur);
-+ if (win_current() == root) return;
-+
-+ XEvent ev = { .type = ClientMessage };
-+
-+ ev.xclient.window = cur;
-+ ev.xclient.format = 32;
-+ ev.xclient.message_type = XInternAtom(d, "WM_PROTOCOLS", True);
-+ ev.xclient.data.l[0] = XInternAtom(d, "WM_DELETE_WINDOW", True);
-+ ev.xclient.data.l[1] = CurrentTime;
-+
-+ XSendEvent(d, cur, False, NoEventMask, &ev);
- }
-
- /*
diff --git a/sowm.c b/sowm.c
index 126aca0..cd8af6f 100644
--- a/sowm.c
+++ b/sowm.c
@@ -180,7 +180,17 @@ void win_del(Window w) {
}
void win_kill() {
- if (win_current() ^ root) XKillClient(d, cur);
+ if (win_current() == root) return;
+
+ XEvent ev = { .type = ClientMessage };
+
+ ev.xclient.window = cur;
+ ev.xclient.format = 32;
+ ev.xclient.message_type = XInternAtom(d, "WM_PROTOCOLS", True);
+ ev.xclient.data.l[0] = XInternAtom(d, "WM_DELETE_WINDOW", True);
+ ev.xclient.data.l[1] = CurrentTime;
+
+ XSendEvent(d, cur, False, NoEventMask, &ev);
}
void win_center(const Arg arg) {

View File

@ -0,0 +1,106 @@
diff --git a/Makefile b/Makefile
index 3154a2f..243b744 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CFLAGS+= -std=c99 -Wall -Wextra -pedantic -Wno-deprecated-declarations
-LDADD+= -lX11
+LDADD+= -lX11 -lXext
LDFLAGS=
PREFIX?= /usr
BINDIR?= $(PREFIX)/bin
diff --git a/config.def.h b/config.def.h
index 3cef34b..e7f1518 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,6 +2,7 @@
#define CONFIG_H
#define MOD Mod4Mask
+#define ROUND_CORNERS 20
const char* menu[] = {"dmenu_run", 0};
const char* term[] = {"st", 0};
diff --git a/sowm.c b/sowm.c
index 126aca0..5c99c5c 100644
--- a/sowm.c
+++ b/sowm.c
@@ -3,6 +3,7 @@
#include <X11/Xlib.h>
#include <X11/XF86keysym.h>
#include <X11/keysym.h>
+#include <X11/extensions/shape.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
@@ -41,6 +42,7 @@ static void win_del(Window w);
static void win_fs();
static void win_kill();
static void win_next();
+static void win_round_corners(Window w, int rad);
static void win_to_ws(const Arg arg);
static void ws_go(const Arg arg);
static int xerror() { return 0;}
@@ -105,6 +107,9 @@ void notify_motion(XEvent *e) {
wy + (mouse.button == 1 ? yd : 0),
ww + (mouse.button == 3 ? xd : 0),
wh + (mouse.button == 3 ? yd : 0));
+
+ if (mouse.button == 3)
+ win_round_corners(mouse.subwindow, ROUND_CORNERS);
}
void key_press(XEvent *e) {
@@ -201,9 +206,44 @@ void win_fs() {
} else
XMoveResizeWindow(d, cur, c->wx, c->wy, c->ww, c->wh);
+
+ win_round_corners(cur, c->f ? 0 : ROUND_CORNERS);
}
}
+void win_round_corners(Window w, int rad) {
+ unsigned int ww, wh, dia = 2 * rad;
+
+ win_size(w, &(int){1}, &(int){1}, &ww, &wh);
+
+ if (ww < dia || wh < dia) return;
+
+ Pixmap mask = XCreatePixmap(d, w, ww, wh, 1);
+
+ if (!mask) return;
+
+ XGCValues xgcv;
+ GC shape_gc = XCreateGC(d, mask, 0, &xgcv);
+
+ if (!shape_gc) {
+ XFreePixmap(d, mask);
+ return;
+ }
+
+ XSetForeground(d, shape_gc, 0);
+ XFillRectangle(d, mask, shape_gc, 0, 0, ww, wh);
+ XSetForeground(d, shape_gc, 1);
+ XFillArc(d, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
+ XFillArc(d, mask, shape_gc, ww-dia-1, 0, dia, dia, 0, 23040);
+ XFillArc(d, mask, shape_gc, 0, wh-dia-1, dia, dia, 0, 23040);
+ XFillArc(d, mask, shape_gc, ww-dia-1, wh-dia-1, dia, dia, 0, 23040);
+ XFillRectangle(d, mask, shape_gc, rad, 0, ww-dia, wh);
+ XFillRectangle(d, mask, shape_gc, 0, rad, ww, wh-dia);
+ XShapeCombineMask(d, w, ShapeBounding, 0, 0, mask, ShapeSet);
+ XFreePixmap(d, mask);
+ XFreeGC(d, shape_gc);
+}
+
void win_to_ws(const Arg arg) {
int tmp = ws;
win_current();
@@ -275,6 +315,7 @@ void map_request(XEvent *e) {
if (wx == 0 && wy == 0) win_center((Arg){.i = w});
XMapWindow(d, w);
+ win_round_corners(w, ROUND_CORNERS);
win_focus(w);
win_add(w);
}

256
sowm.c
View File

@ -3,20 +3,55 @@
#include <X11/Xlib.h>
#include <X11/XF86keysym.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include "sowm.h"
typedef union {
const char** com;
const int i;
const Window w;
} Arg;
static client *list = {0}, *ws_list[10] = {0}, *cur;
static int ws = 1, sw, sh, wx, wy, numlock = 0;
struct key {
unsigned int mod;
KeySym keysym;
void (*function)(const Arg arg);
const Arg arg;
};
typedef struct client {
struct client *next, *prev;
int f, wx, wy;
unsigned int w, ww, wh;
} client;
static void button_press(XEvent *e);
static void button_release();
static void configure_request(XEvent *e);
static void key_press(XEvent *e);
static void map_request(XEvent *e);
static void notify_destroy(XEvent *e);
static void notify_enter(XEvent *e);
static void notify_motion(XEvent *e);
static void run(const Arg arg);
static void win_add(Window w);
static void win_center(const Arg arg);
static void win_del(Window w);
static void win_fs();
static void win_kill();
static void win_next();
static void win_to_ws(const Arg arg);
static void ws_go(const Arg arg);
static int xerror() { return 0;}
static client *list = {0}, *ws_list[10] = {0};
static int ws = 1, sw, sh, wx, wy;
static unsigned int ww, wh;
static Display *d;
static Window root, cur;
static XButtonEvent mouse;
static Window root;
static void (*events[LASTEvent])(XEvent *e) = {
[ButtonPress] = button_press,
@ -24,7 +59,6 @@ static void (*events[LASTEvent])(XEvent *e) = {
[ConfigureRequest] = configure_request,
[KeyPress] = key_press,
[MapRequest] = map_request,
[MappingNotify] = mapping_notify,
[DestroyNotify] = notify_destroy,
[EnterNotify] = notify_enter,
[MotionNotify] = notify_motion
@ -32,148 +66,172 @@ static void (*events[LASTEvent])(XEvent *e) = {
#include "config.h"
void win_focus(client *c) {
cur = c;
XSetInputFocus(d, cur->w, RevertToParent, CurrentTime);
#define win (client *c=list;c;c=c->next)
#define win_focus(W) XSetInputFocus(d, W, RevertToParent, CurrentTime)
#define ws_save(W) ws_list[W] = list
#define ws_sel(W) list = ws_list[ws = W]
#define win_size(W, gx, gy, gw, gh) \
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
&(unsigned int){0}, &(unsigned int){0})
Window win_current() {
XGetInputFocus(d, &cur, (int[]){1});
return cur;
}
void notify_destroy(XEvent *e) {
win_del(e->xdestroywindow.window);
if (list) win_focus(list->prev);
if (list) win_focus(win_current() == root ? list->w : cur);
}
void notify_enter(XEvent *e) {
while(XCheckTypedEvent(d, EnterNotify, e));
for win if (c->w == e->xcrossing.window) win_focus(c);
win_focus(e->xcrossing.window);
}
void notify_motion(XEvent *e) {
if (!mouse.subwindow || cur->f) return;
while(XCheckTypedEvent(d, MotionNotify, e));
if (mouse.subwindow == 0) return;
int xd = e->xbutton.x_root - mouse.x_root;
int yd = e->xbutton.y_root - mouse.y_root;
while(XCheckTypedEvent(d, MotionNotify, e));
XMoveResizeWindow(d, mouse.subwindow,
wx + (mouse.button == 1 ? xd : 0),
wy + (mouse.button == 1 ? yd : 0),
MAX(1, ww + (mouse.button == 3 ? xd : 0)),
MAX(1, wh + (mouse.button == 3 ? yd : 0)));
ww + (mouse.button == 3 ? xd : 0),
wh + (mouse.button == 3 ? yd : 0));
}
void key_press(XEvent *e) {
KeySym keysym = XkbKeycodeToKeysym(d, e->xkey.keycode, 0, 0);
KeySym keysym = XKeycodeToKeysym(d, e->xkey.keycode, 0);
for (unsigned int i=0; i < sizeof(keys)/sizeof(*keys); ++i)
if (keys[i].keysym == keysym &&
mod_clean(keys[i].mod) == mod_clean(e->xkey.state))
if (keys[i].keysym == keysym && keys[i].mod == e->xkey.state)
keys[i].function(keys[i].arg);
}
void button_press(XEvent *e) {
if (!e->xbutton.subwindow) return;
if (e->xbutton.subwindow == 0) return;
win_size(e->xbutton.subwindow, &wx, &wy, &ww, &wh);
XRaiseWindow(d, e->xbutton.subwindow);
mouse = e->xbutton;
}
void button_release(XEvent *e) {
void button_release() {
for win if (c->w == mouse.subwindow) c->f = 0;
mouse.subwindow = 0;
}
void win_add(Window w) {
client *c;
client *c, *t;
if (!(c = (client *) calloc(1, sizeof(client))))
if (!(c = (client *)calloc(1, sizeof(client))))
exit(1);
if (!list) {
c->next = c->prev = 0;
c->w = w;
if (list) {
list->prev->next = c;
c->prev = list->prev;
list->prev = c;
c->next = list;
list = c;
} else {
list = c;
list->prev = list->next = list;
for (t=list;t->next;t=t->next);
c->next = 0;
c->prev = t;
c->w = w;
t->next = c;
}
ws_save(ws);
}
void win_del(Window w) {
client *x = 0;
for win if (c->w == w) x = c;
if (!list || !x) return;
if (x->prev == x) list = 0;
if (list == x) list = x->next;
if (x->next) x->next->prev = x->prev;
if (x->prev) x->prev->next = x->next;
free(x);
for win if (c->w == w) {
if (!c->prev && !c->next) {
free(list);
list = 0;
ws_save(ws);
return;
}
if (!c->prev) {
list = c->next;
c->next->prev = 0;
} else if (!c->next) {
c->prev->next = 0;
} else {
c->prev->next = c->next;
c->next->prev = c->prev;
}
free(c);
ws_save(ws);
return;
}
}
void win_kill(const Arg arg) {
if (cur) XKillClient(d, cur->w);
void win_kill() {
if (win_current() ^ root) XKillClient(d, cur);
}
void win_center(const Arg arg) {
if (!cur) return;
Window w = arg.w ? arg.w : win_current();
win_size(cur->w, &(int){0}, &(int){0}, &ww, &wh);
XMoveWindow(d, cur->w, (sw - ww) / 2, (sh - wh) / 2);
win_size(w, &(int){0}, &(int){0}, &ww, &wh);
XMoveWindow(d, w, (sw - ww) / 2, (sh - wh) / 2);
}
void win_fs(const Arg arg) {
if (!cur) return;
void win_fs() {
win_current();
if ((cur->f = cur->f ? 0 : 1)) {
win_size(cur->w, &cur->wx, &cur->wy, &cur->ww, &cur->wh);
XMoveResizeWindow(d, cur->w, 0, 0, sw, sh);
for win if (c->w == cur) {
if ((c->f = c->f == 0 ? 1 : 0)) {
win_size(cur, &c->wx, &c->wy, &c->ww, &c->wh);
XMoveResizeWindow(d, cur, 0, 0, sw, sh);
} else {
XMoveResizeWindow(d, cur->w, cur->wx, cur->wy, cur->ww, cur->wh);
} else
XMoveResizeWindow(d, cur, c->wx, c->wy, c->ww, c->wh);
}
}
void win_to_ws(const Arg arg) {
int tmp = ws;
win_current();
if (arg.i == tmp) return;
ws_sel(arg.i);
win_add(cur->w);
win_add(cur);
ws_save(arg.i);
ws_sel(tmp);
win_del(cur->w);
XUnmapWindow(d, cur->w);
win_del(cur);
XUnmapWindow(d, cur);
ws_save(tmp);
if (list) win_focus(list);
if (list) win_focus(list->w);
}
void win_prev(const Arg arg) {
if (!cur) return;
void win_next() {
win_current();
XRaiseWindow(d, cur->prev->w);
win_focus(cur->prev);
}
for win if (c->w == cur) {
c = c->next ? c->next : list;
void win_next(const Arg arg) {
if (!cur) return;
XRaiseWindow(d, cur->next->w);
win_focus(cur->next);
win_focus(c->w);
XRaiseWindow(d, c->w);
return;
}
}
void ws_go(const Arg arg) {
@ -184,15 +242,15 @@ void ws_go(const Arg arg) {
ws_save(ws);
ws_sel(arg.i);
for win XMapWindow(d, c->w);
if (list) for win XMapWindow(d, c->w);
ws_sel(tmp);
for win XUnmapWindow(d, c->w);
if (list) for win XUnmapWindow(d, c->w);
ws_sel(arg.i);
if (list) win_focus(list); else cur = 0;
if (list) win_focus(list->w);
}
void configure_request(XEvent *e) {
@ -213,22 +271,12 @@ void map_request(XEvent *e) {
XSelectInput(d, w, StructureNotifyMask|EnterWindowMask);
win_size(w, &wx, &wy, &ww, &wh);
win_add(w);
cur = list->prev;
if (wx + wy == 0) win_center((Arg){0});
if (wx == 0 && wy == 0) win_center((Arg){.i = w});
XMapWindow(d, w);
win_focus(list->prev);
}
void mapping_notify(XEvent *e) {
XMappingEvent *ev = &e->xmapping;
if (ev->request == MappingKeyboard || ev->request == MappingModifier) {
XRefreshKeyboardMapping(ev);
input_grab(root);
}
win_focus(w);
win_add(w);
}
void run(const Arg arg) {
@ -239,34 +287,6 @@ void run(const Arg arg) {
execvp((char*)arg.com[0], (char**)arg.com);
}
void input_grab(Window root) {
unsigned int i, j, modifiers[] = {0, LockMask, numlock, numlock|LockMask};
XModifierKeymap *modmap = XGetModifierMapping(d);
KeyCode code;
for (i = 0; i < 8; i++)
for (int k = 0; k < modmap->max_keypermod; k++)
if (modmap->modifiermap[i * modmap->max_keypermod + k]
== XKeysymToKeycode(d, 0xff7f))
numlock = (1 << i);
XUngrabKey(d, AnyKey, AnyModifier, root);
for (i = 0; i < sizeof(keys)/sizeof(*keys); i++)
if ((code = XKeysymToKeycode(d, keys[i].keysym)))
for (j = 0; j < sizeof(modifiers)/sizeof(*modifiers); j++)
XGrabKey(d, code, keys[i].mod | modifiers[j], root,
True, GrabModeAsync, GrabModeAsync);
for (i = 1; i < 4; i += 2)
for (j = 0; j < sizeof(modifiers)/sizeof(*modifiers); j++)
XGrabButton(d, i, MOD | modifiers[j], root, True,
ButtonPressMask|ButtonReleaseMask|PointerMotionMask,
GrabModeAsync, GrabModeAsync, 0, 0);
XFreeModifiermap(modmap);
}
int main(void) {
XEvent ev;
@ -282,8 +302,16 @@ int main(void) {
XSelectInput(d, root, SubstructureRedirectMask);
XDefineCursor(d, root, XCreateFontCursor(d, 68));
input_grab(root);
while (1 && !XNextEvent(d, &ev)) // 1 && will forever be here.
for (unsigned int i=0; i < sizeof(keys)/sizeof(*keys); ++i)
XGrabKey(d, XKeysymToKeycode(d, keys[i].keysym), keys[i].mod,
root, True, GrabModeAsync, GrabModeAsync);
for (int i=1; i<4; i+=2)
XGrabButton(d, i, MOD, root, True,
ButtonPressMask|ButtonReleaseMask|PointerMotionMask,
GrabModeAsync, GrabModeAsync, 0, 0);
while (1 && !XNextEvent(d, &ev))
if (events[ev.type]) events[ev.type](&ev);
}

58
sowm.h
View File

@ -1,58 +0,0 @@
#include <X11/Xlib.h>
#define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next)
#define ws_save(W) ws_list[W] = list
#define ws_sel(W) list = ws_list[ws = W]
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define win_size(W, gx, gy, gw, gh) \
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
&(unsigned int){0}, &(unsigned int){0})
// Taken from DWM. Many thanks. https://git.suckless.org/dwm
#define mod_clean(mask) (mask & ~(numlock|LockMask) & \
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
typedef struct {
const char** com;
const int i;
const Window w;
} Arg;
struct key {
unsigned int mod;
KeySym keysym;
void (*function)(const Arg arg);
const Arg arg;
};
typedef struct client {
struct client *next, *prev;
int f, wx, wy;
unsigned int ww, wh;
Window w;
} client;
void button_press(XEvent *e);
void button_release(XEvent *e);
void configure_request(XEvent *e);
void input_grab(Window root);
void key_press(XEvent *e);
void map_request(XEvent *e);
void mapping_notify(XEvent *e);
void notify_destroy(XEvent *e);
void notify_enter(XEvent *e);
void notify_motion(XEvent *e);
void run(const Arg arg);
void win_add(Window w);
void win_center(const Arg arg);
void win_del(Window w);
void win_fs(const Arg arg);
void win_focus(client *c);
void win_kill(const Arg arg);
void win_prev(const Arg arg);
void win_next(const Arg arg);
void win_to_ws(const Arg arg);
void ws_go(const Arg arg);
static int xerror() { return 0; }