diff options
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | config.h | 40 | ||||
| -rw-r--r-- | monsterwm.c | 23 |
3 files changed, 38 insertions, 26 deletions
@@ -9,6 +9,7 @@ Maintaining my version of monsterwm. Changes: - add `ignore` to AppRules to allow, e.g., stalonetray without being managed - print status for lemonbar periodically (and on every update event) - prevent running commands from writing to stdout (to preserve status) +- add RTILE for tiling with main window on the right (default) → tiny and monstrous! --------------------- @@ -10,17 +10,17 @@ #define SHIFT ShiftMask /* Shift key */ /** generic settings **/ -#define MASTER_SIZE 0.6 +#define MASTER_SIZE 0.55 #define SHOW_PANEL True /* show panel by default on exec */ #define TOP_PANEL False /* False means panel is on bottom */ #define PANEL_HEIGHT 18 /* 0 for no space for panel, thus no panel */ -#define DEFAULT_MODE TILE /* initial layout/mode: TILE MONOCLE BSTACK GRID FLOAT */ +#define DEFAULT_MODE RTILE /* initial layout/mode: TILE MONOCLE BSTACK RTILE FLOAT */ #define ATTACH_ASIDE True /* False means new window is master */ #define FOLLOW_WINDOW False /* follow the window when moved to a different desktop */ #define FOLLOW_MOUSE False /* focus the window the mouse just entered */ #define CLICK_TO_FOCUS True /* focus an unfocused window when clicked */ #define FOCUS_BUTTON Button3 /* mouse button to be used along with CLICK_TO_FOCUS */ -#define BORDER_WIDTH 2 /* window border width */ +#define BORDER_WIDTH 1 /* window border width */ #define FOCUS "#ff950e" /* focused window border color */ #define UNFOCUS "#444444" /* unfocused window border color */ #define MINWSZ 50 /* minimum window size in pixels */ @@ -73,7 +73,7 @@ static Key keys[] = { { MOD4, XK_space, spawn, {.com = mpc_toggle } }, { MOD4|SHIFT, XK_space, spawn, {.com = albumbler } }, { MOD4|SHIFT|CONTROL, XK_space, spawn, {.com = now_playing } }, - { MOD4, XK_h, spawn, {.com = lock } }, + { MOD4, XK_p, spawn, {.com = lock } }, { MOD4|SHIFT|CONTROL, XK_q, quit, {.i = 0} }, /* quit with exit value 0 */ // Multimedia @@ -82,32 +82,34 @@ static Key keys[] = { { 0, XF86AudioMute, spawn, {.com = vol_mt } }, // Windows - { MOD4, XK_n, next_win, {NULL} }, - { MOD4, XK_o, prev_win, {NULL} }, - { MOD4|SHIFT, XK_n, move_down, {NULL} }, - { MOD4|SHIFT, XK_o, move_up, {NULL} }, + { MOD4, XK_c, next_win, {NULL} }, + { MOD4, XK_i, prev_win, {NULL} }, + { MOD4|SHIFT, XK_c, move_down, {NULL} }, + { MOD4|SHIFT, XK_i, move_up, {NULL} }, { MOD4|SHIFT, XK_k, killclient, {NULL} }, { MOD4, XK_Return, swap_master, {NULL} }, { MOD4, XK_BackSpace, focusurgent, {NULL} }, { MOD4, XK_e, resize_master, {.i = +10} }, /* increase size in px */ - { MOD4, XK_i, resize_master, {.i = -10} }, /* decrease size in px */ + { MOD4, XK_n, resize_master, {.i = -10} }, /* decrease size in px */ + { MOD4|SHIFT, XK_e, resize_stack, {.i = +10} }, /* increase size in px */ + { MOD4|SHIFT, XK_n, resize_stack, {.i = -10} }, /* decrease size in px */ // Desktops { MOD4, XK_Tab, last_desktop, {NULL} }, - DESKTOPCHANGE( XK_l, 0) + DESKTOPCHANGE( XK_f, 0) DESKTOPCHANGE( XK_u, 1) - DESKTOPCHANGE( XK_y, 2) - DESKTOPCHANGE( XK_semicolon, 3) - DESKTOPCHANGE( XK_q, 4) - DESKTOPCHANGE( XK_w, 5) - DESKTOPCHANGE( XK_f, 6) - DESKTOPCHANGE( XK_p, 7) + DESKTOPCHANGE( XK_h, 2) + DESKTOPCHANGE( XK_comma, 3) + DESKTOPCHANGE( XK_v, 4) + DESKTOPCHANGE( XK_l, 5) + DESKTOPCHANGE( XK_o, 6) + DESKTOPCHANGE( XK_m, 7) // Layouts - { MOD4, XK_a, switch_mode, {.i = TILE} }, + { MOD4, XK_s, switch_mode, {.i = TILE} }, { MOD4, XK_r, switch_mode, {.i = MONOCLE} }, - { MOD4, XK_s, switch_mode, {.i = BSTACK} }, - { MOD4|SHIFT, XK_a, switch_mode, {.i = GRID} }, + { MOD4, XK_a, switch_mode, {.i = BSTACK} }, + { MOD4|SHIFT, XK_s, switch_mode, {.i = RTILE} }, { MOD4|SHIFT, XK_r, switch_mode, {.i = FLOAT} }, { MOD4, XK_b, togglepanel, {NULL} }, }; diff --git a/monsterwm.c b/monsterwm.c index 61f10d5..fd064f2 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -23,7 +23,7 @@ #define ROOTMASK SubstructureRedirectMask|ButtonPressMask|SubstructureNotifyMask|PropertyChangeMask enum { RESIZE, MOVE }; -enum { TILE, MONOCLE, BSTACK, GRID, FLOAT, MODES }; +enum { TILE, MONOCLE, BSTACK, RTILE, FLOAT, MODES }; enum { WM_PROTOCOLS, WM_DELETE_WINDOW, WM_COUNT }; enum { NET_SUPPORTED, NET_FULLSCREEN, NET_WM_STATE, NET_ACTIVE, NET_COUNT }; @@ -93,6 +93,7 @@ static void next_win(); static void prev_win(); static void quit(const Arg *arg); static void resize_master(const Arg *arg); +static void resize_stack(const Arg *arg); static void spawn(const Arg *arg); static void swap_master(); static void switch_mode(const Arg *arg); @@ -154,7 +155,6 @@ static void focusin(XEvent *e); static unsigned long getcolor(const char* color, const int screen); static void grabbuttons(Client *c); static void grabkeys(void); -static void grid(int x, int y, int w, int h, const Desktop *d); static void keypress(XEvent *e); static void maprequest(XEvent *e); static void monocle(int x, int y, int w, int h, const Desktop *d); @@ -217,7 +217,7 @@ static void (*events[LASTEvent])(XEvent *e) = { * d - the desktop to tile its clients */ static void (*layout[MODES])(int x, int y, int w, int h, const Desktop *d) = { - [TILE] = stack, [BSTACK] = stack, [GRID] = grid, [MONOCLE] = monocle, + [TILE] = stack, [BSTACK] = stack, [RTILE] = stack, [MONOCLE] = monocle, }; /** @@ -1012,6 +1012,14 @@ void resize_master(const Arg *arg) { } /** + * resize the first stack window + */ +void resize_stack(const Arg *arg) { + desktops[currdeskidx].sasz += arg->i; + tile(&desktops[currdeskidx]); +} + +/** * main event loop * on receival of an event call the appropriate handler */ @@ -1139,7 +1147,7 @@ void spawn(const Arg *arg) { * bstack or bottom stack aka h-stack mode/layout */ void stack(int x, int y, int w, int h, const Desktop *d) { - Client *c = NULL, *t = NULL; Bool b = (d->mode == BSTACK); + Client *c = NULL, *t = NULL; Bool b = (d->mode == BSTACK), r = (d->mode == RTILE); int n = 0, p = 0, z = (b ? w:h), ma = (b ? h:w) * MASTER_SIZE + d->masz; /* count stack windows and grab first non-floating, non-fullscreen window */ @@ -1178,14 +1186,15 @@ void stack(int x, int y, int w, int h, const Desktop *d) { if (!c || !n) return; else if (n > 1) { p = (z - d->sasz)%n + d->sasz; z = (z - d->sasz)/n; } /* tile the first non-floating, non-fullscreen window to cover the master area */ - if (b) XMoveResizeWindow(dis, c->win, x, y, w - 2*BORDER_WIDTH, ma - BORDER_WIDTH); - else XMoveResizeWindow(dis, c->win, x, y, ma - BORDER_WIDTH, h - 2*BORDER_WIDTH); + if (b) XMoveResizeWindow(dis, c->win, x, y, w - 2*BORDER_WIDTH, ma - BORDER_WIDTH); + else if (r) XMoveResizeWindow(dis, c->win, w - ma + BORDER_WIDTH, y, ma, h - 2*BORDER_WIDTH); + else XMoveResizeWindow(dis, c->win, x, y, ma - BORDER_WIDTH, h - 2*BORDER_WIDTH); /* tile the next non-floating, non-fullscreen (and first) stack window adding p */ for (c = c->next; c && ISFFT(c); c = c->next); int cw = (b ? h:w) - 2*BORDER_WIDTH - ma, ch = z - BORDER_WIDTH; if (b) XMoveResizeWindow(dis, c->win, x, y += ma, ch - BORDER_WIDTH + p, cw); - else XMoveResizeWindow(dis, c->win, x += ma, y, cw, ch - BORDER_WIDTH + p); + else XMoveResizeWindow(dis, c->win, r ? x : (x += ma), y, cw, ch - BORDER_WIDTH + p); /* tile the rest of the non-floating, non-fullscreen stack windows */ for (b ? (x += ch+p):(y += ch+p), c = c->next; c; c = c->next) { |
