From fd7b18b3c20bc4e2685cd0d6ac14d4b87ba89cf2 Mon Sep 17 00:00:00 2001 From: uint23 Date: Fri, 25 Apr 2025 23:08:02 +0100 Subject: starting to add custom config added config struct added sxrc config file ~ master_width is now an int --- defsxrc | 18 ++++++++++++++++++ src/config.h | 7 +++---- src/defs.h | 12 ++++++++++++ src/sxwm.c | 2 +- 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 defsxrc diff --git a/defsxrc b/defsxrc new file mode 100644 index 0000000..f0c091b --- /dev/null +++ b/defsxrc @@ -0,0 +1,18 @@ +# Colour Themes: +border_focused_colour = #c0cbff +border_unfocused_colour = #555555 +border_swap_colour = #fff4c0 + +# General Options: +master_coverage = 60% +gaps = 10 + +# Keybinds: +# Commands must be surrounded with "" +# Function calls don't need this + +mod_key = alt + +bind mod + shift + return = "st" +# this is an internal command - a pointer to a function +bind mod + j = focus_next diff --git a/src/config.h b/src/config.h index 342a54b..6437468 100644 --- a/src/config.h +++ b/src/config.h @@ -21,10 +21,9 @@ * The colour of your border when the * window is unfocused * - * MASTER_WIDTH (float): + * MASTER_WIDTH (int): * % of the screen the master window - * should take as a decimal value 0-1 - * eg. 0.5 is 50% + * should take * * RESIZE_MASTER_AMT (%): * % of the master width you want to @@ -65,7 +64,7 @@ #define BORDER_UFOC_COL "#555555" #define BORDER_SWAP_COL "#fff4c0" -#define MASTER_WIDTH 0.6 +#define MASTER_WIDTH 60 #define RESIZE_MASTER_AMT 1 #define MOTION_THROTTLE 60 #define SNAP_DISTANCE 5 diff --git a/src/defs.h b/src/defs.h index 8059099..373cfee 100644 --- a/src/defs.h +++ b/src/defs.h @@ -102,6 +102,18 @@ typedef struct Client{ struct Client *next; } Client; +typedef struct { + uint gaps; + uint border_width; + ulong border_foc_col; + ulong border_ufoc_col; + ulong border_swap_col; + uint master_width; + uint resize_master_amt; + uint snap_distance; + Binding *binds; +} Config; + typedef struct { int x, y; uint w, h; diff --git a/src/sxwm.c b/src/sxwm.c index 27dafba..983326c 100644 --- a/src/sxwm.c +++ b/src/sxwm.c @@ -110,7 +110,7 @@ ulong last_motion_time = 0; ulong border_foc_col; ulong border_ufoc_col; ulong border_swap_col; -float master_frac = MASTER_WIDTH; +float master_frac = (float) MASTER_WIDTH / 100; uint gaps = GAPS; uint scr_width; uint scr_height; -- cgit v1.2.3