sowm

An itsy bitsy floating window manager (220~ sloc!).
git clone git://mfeller.io/sowm.git
Log | Files | Refs | README | LICENSE

commit f603fbb49cd7fbb808c3b8996d9b51d8b8edde5c
parent 472fda5fa0ef1e2606ad6994e50834bbe19f527e
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Fri, 11 Oct 2019 21:19:40 +0300

docs: update

Diffstat:
Mcatwm.c | 34+++++-----------------------------
Mconfig.h | 4++--
2 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/catwm.c b/catwm.c @@ -54,7 +54,6 @@ static void map_request(XEvent *e); static void run(const Arg arg); -static void sig_kill(Window w); static void sig_child(int unused); static void key_grab(); @@ -68,7 +67,7 @@ static void win_add(Window w); static void win_del(Window w); static void win_fs(); static void win_kill(); -static void win_mid(); +static void win_center(); static void win_next(); static void win_to_ws(const Arg arg); static void win_update(); @@ -151,7 +150,7 @@ void ws_go(const Arg arg) { win_update(); } -void win_mid() { +void win_center() { XGetWindowAttributes(dis, current->win, &attr); int x = (sw / 2) - (attr.width / 2); @@ -279,19 +278,8 @@ void button_release(XEvent *e) { } void win_kill() { - if(current != NULL) { - XEvent ke; - - ke.type = ClientMessage; - ke.xclient.window = current->win; - ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True); - ke.xclient.format = 32; - ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True); - ke.xclient.data.l[1] = CurrentTime; - - XSendEvent(dis, current->win, False, NoEventMask, &ke); - sig_kill(current->win); - } + if(current != NULL) + XKillClient(dis, current->win); } void map_request(XEvent *e) { @@ -306,6 +294,7 @@ void map_request(XEvent *e) { } win_add(ev->window); + // win_center(); XMapWindow(dis,ev->window); win_update(); } @@ -377,19 +366,6 @@ void ws_sel(int i) { curr_desk = i; } -void sig_kill(Window w) { - XEvent ke; - - ke.type = ClientMessage; - ke.xclient.window = w; - ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True); - ke.xclient.format = 32; - ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True); - ke.xclient.data.l[1] = CurrentTime; - - XSendEvent(dis, w, False, NoEventMask, &ke); -} - void wm_setup() { int i; diff --git a/config.h b/config.h @@ -23,8 +23,8 @@ const char* volup[] = {"amixer","sset","Master","5\%+",NULL}; { MOD|ShiftMask, K, win_to_ws, {.i = N}}, static struct key keys[] = { - {MOD, XK_q, win_kill, {NULL}}, - {MOD, XK_c, win_mid, {NULL}}, + {MOD, XK_q, win_kill, {NULL}}, + {MOD, XK_c, win_center, {NULL}}, {MOD, XK_f, win_fs, {NULL}}, {Mod1Mask, XK_Tab, win_next, {NULL}},