sowm

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

commit cada809f656da04136a3209f95d1bd0a95066c8e
parent 0ae4e7918f199adf0473c9c44f60bcd44bb8ba16
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Thu, 17 Oct 2019 18:45:47 +0300

sowm: use simpler structure for storing workspaces.

Diffstat:
MREADME.md | 2+-
Msowm.c | 22++++++++--------------
2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md @@ -2,7 +2,7 @@ <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 (*250~ sloc / 24kb compiled!*). +An itsy bitsy floating window manager (*240~ sloc / 24kb compiled!*). - Floating only. - Fullscreen toggle. diff --git a/sowm.c b/sowm.c @@ -20,16 +20,11 @@ struct key { const Arg arg; }; -typedef struct client client; -struct client{ - client *next, *prev; - Window w; +typedef struct client { + struct client *next, *prev; int f, wx, wy; - unsigned int ww, wh; -}; - -typedef struct desktop desktop; -struct desktop{client *list;}; + unsigned int w, ww, wh; +} client; static void button_press(XEvent *e); static void button_release(); @@ -50,8 +45,7 @@ static void win_to_ws(const Arg arg); static void ws_go(const Arg arg); static int xerror() { return 0;} -static client *list = {0}; -static desktop ws_list[10]; +static client *list = {0}, *ws_list[10] = {0}; static int ws = 1, sw, sh, wx, wy; static unsigned int ww, wh; @@ -74,8 +68,8 @@ static void (*events[LASTEvent])(XEvent *e) = { #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 = list -#define ws_sel(W) list = ws_list[ws = W].list +#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, \ @@ -186,7 +180,7 @@ void win_del(Window w) { } void win_kill() { - if (win_current() != root) XKillClient(d, cur); + if (win_current() ^ root) XKillClient(d, cur); } void win_center(const Arg arg) {