From f94aba51225ad67814dc0a68afc282f629834d93 Mon Sep 17 00:00:00 2001 From: uint23 Date: Sun, 20 Apr 2025 07:42:23 +0100 Subject: rename config, added resizeable master --- src/sxwm.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/sxwm.c') diff --git a/src/sxwm.c b/src/sxwm.c index 8d17aad..f0e1a88 100644 --- a/src/sxwm.c +++ b/src/sxwm.c @@ -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; @@ -618,6 +621,24 @@ quit(void) errx(0, "quitting..."); } +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) { @@ -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; -- cgit v1.2.3