diff options
author | uint23 <https://uint23.xyz/> | 2025-04-20 07:42:23 +0100 |
---|---|---|
committer | uint23 <https://uint23.xyz/> | 2025-04-20 07:42:23 +0100 |
commit | f94aba51225ad67814dc0a68afc282f629834d93 (patch) | |
tree | 21a344e349def0246b8a05a94bb243646abeaf31 | |
parent | e9bb3c2992bd141c92ea2a15d948978e9709bf76 (diff) |
rename config, added resizeable master
-rw-r--r-- | src/config.h (renamed from src/config) | 12 | ||||
-rw-r--r-- | src/defs.h | 2 | ||||
-rw-r--r-- | src/sxwm.c | 27 |
3 files changed, 36 insertions, 5 deletions
diff --git a/src/config b/src/config.h index 97e15bc..16f7f3b 100644 --- a/src/config +++ b/src/config.h @@ -25,6 +25,10 @@ * % of the screen the master window * should take as a decimal value 0-1 * eg. 0.5 is 50% + * + * RESIZE_MASTER_AMT (%): + * % of the master width you want to + * increment by * * MOTION_THROTTLE (int): * Usually you should set this to your @@ -54,11 +58,12 @@ #define GAPS 10 -#define BORDER_WIDTH 5 +#define BORDER_WIDTH 1 #define BORDER_FOC_COL "#005577" #define BORDER_UFOC_COL "#444444" -#define MASTER_WIDTH 0.5 +#define MASTER_WIDTH 0.6 +#define RESIZE_MASTER_AMT 1 #define MOTION_THROTTLE 60 #define SNAP_DISTANCE 5 @@ -172,6 +177,9 @@ static const Binding binds[] = CALL(MOD|SHIFT, j, move_master_next), CALL(MOD|SHIFT, k, move_master_prev), + CALL(MOD, l, resize_master_add), + CALL(MOD, h, resize_master_sub), + CALL(MOD, equal, inc_gaps), CALL(MOD, minus, dec_gaps), @@ -19,6 +19,8 @@ #define MARGIN (gaps + BORDER_WIDTH) #define OUT_IN (2 * BORDER_WIDTH) +#define MF_MIN 0.05f +#define MF_MAX 0.95f #define LENGTH(X) (sizeof X / sizeof X[0]) #define BIND(mod, key, cmdstr) { (mod), XK_##key, { cmdstr }, False } #define CALL(mod, key, fnptr) { (mod), XK_##key, { .fn = fnptr }, True } @@ -53,6 +53,8 @@ static void other_wm(void); static int other_wm_err(Display *dpy, XErrorEvent *ee); static ulong parse_col(const char *hex); static void quit(void); +static void resize_master_add(void); +static void resize_master_sub(void); static void run(void); static void setup(void); static void setup_atoms(void); @@ -65,7 +67,7 @@ static void update_borders(void); static void update_net_client_list(void); static int xerr(Display *dpy, XErrorEvent *ee); static void xev_case(XEvent *xev); -#include "config" +#include "config.h" static Atom atom_net_supported; static Atom atom_wm_strut_partial; @@ -88,6 +90,7 @@ static Bool global_floating = False; static ulong last_motion_time = 0; static ulong border_foc_col; static ulong border_ufoc_col; +static float master_frac = MASTER_WIDTH; static uint gaps = GAPS; static uint scr_width; static uint scr_height; @@ -619,6 +622,24 @@ quit(void) } static void +resize_master_add(void) +{ + if (master_frac < MF_MAX - 0.001f) + master_frac += ((float) RESIZE_MASTER_AMT / 100); + tile(); + update_borders(); +} + +static void +resize_master_sub(void) +{ + if (master_frac > MF_MIN + 0.001f) + master_frac -= ((float) RESIZE_MASTER_AMT / 100); + tile(); + update_borders(); +} + +static void run(void) { XEvent xev; @@ -769,9 +790,9 @@ tile(void) uint column_gap = (stack_count > 0 ? gaps : 0); uint master_width = (stack_count > 0) - ? (int)(workarea_width * MASTER_WIDTH) + ? workarea_width * master_frac : workarea_width; - uint stack_width = (stack_count > 0) + uint stack_width = (stack_count > 0) ? (workarea_width - master_width - column_gap) : 0; |