From bcfbc2e218f308d4a6a23e94dd8952591553ad72 Mon Sep 17 00:00:00 2001 From: speediegq Date: Sat, 17 Sep 2022 00:45:58 +0200 Subject: [PATCH] Update: Add lowest mfact float --- docs/example.Xresources | 5 +++++ options.h | 2 ++ speedwm.c | 16 ++++++++++++++-- xresources.h | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/example.Xresources b/docs/example.Xresources index be43a20..ce723e4 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -8,6 +8,7 @@ !! !! Fonts are picked based on (A) order in the list below and (B) what fonts have the character that should be printed. !! If you want more than three fonts, add a comma to font3 and add another to it. +!! - speedwm.font: NotoSans-Regular:size=8:antialiasing=true - speedwm.font2: fontawesome:size=8 - speedwm.font3: Noto Color Emoji:size=8 @@ -103,6 +104,10 @@ !! - speedwm.mfact: 0.50 !! +!! Lowest possible mfact. +!! + - speedwm.lowestmfact: 0.05 +!! !! Start on tag. If this is set to 1, speedwm will start on tag 1. If it is set to 0, then speedwm will not start on tag 1. (1/0) !! - speedwm.startontag: 1 diff --git a/options.h b/options.h index ff143d8..99f68c8 100644 --- a/options.h +++ b/options.h @@ -118,6 +118,7 @@ static int refreshrules = 1; /* Refresh rules when a CLASS static int i3nmaster = 0; /* Enable i3-gaps like nmaster (1/0) */ static int mousemfact = 1; /* Enable adjusting mfact using the mouse (1/0) */ static float mfact = 0.50; /* Default mfact value. 0.50 = each gets half the available space */ +static float lowestmfact = 0.05; /* Lowest possible mfact value on top of the existing. */ /* Window gap options */ static int enablegaps = 1; /* Enable gaps */ @@ -216,6 +217,7 @@ static int barheight = 5; /* Bar height in px, 0 = calc static int barposition = 1; /* Bar position. Top: 0, Bottom: 1 */ static int barpaddingv = 10; /* How much padding to have vertically in pixels */ static int barpaddingh = 10; /* How much padding to have horizontally in pixels */ +static int barpaddinggaps = 1; /* Set barpadding to the gaps */ static int leftlayout = 1; /* Layout indicator on the left (1) or on the right (0) */ /* Tag text options */ diff --git a/speedwm.c b/speedwm.c index 49f60f3..94a751c 100644 --- a/speedwm.c +++ b/speedwm.c @@ -620,6 +620,10 @@ static xcb_connection_t *xcon; /* Modifiers */ #define CONTROL ControlMask #define SHIFT ShiftMask +#define ALT Mod1Mask +#define ALTR Mod3Mask +#define SUPER Mod4Mask +#define SHIFTL Mod5Mask /* Rest of the headers */ @@ -2573,6 +2577,11 @@ void togglegaps(const Arg *arg) { enablegaps = !enablegaps; + + if (barpaddingv != 0 && barpaddingh != 0 && barpaddinggaps && enablegaps) { + updatebarpos(selmon); + } + arrange(selmon); } @@ -4081,7 +4090,7 @@ setmfact(const Arg *arg) if (!arg || !selmon->lt[selmon->sellt]->arrange) return; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; - if (f < 0.05 || f > 0.95) + if (f < 0.05 - lowestmfact || f > 0.95 + lowestmfact ) return; selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f; arrange(selmon); @@ -4722,7 +4731,10 @@ updatebarpos(Monitor *m) { m->wy = m->my; m->wh = m->mh; - if (m->showbar) { + if (barpaddingv != 0 && barpaddingh != 0 && barpaddinggaps && enablegaps) { + barpaddingv = gappov; + barpaddingh = gappoh; + } if (m->showbar) { m->wh = m->wh - barpaddingv - m->bh; m->by = m->barposition ? m->wy : m->wy + m->wh + barpaddingv; m->wy = m->barposition ? m->wy + m->bh + vp : m->wy; diff --git a/xresources.h b/xresources.h index 580b0fd..ada7cb3 100644 --- a/xresources.h +++ b/xresources.h @@ -195,5 +195,6 @@ ResourcePref resources[] = { { "floatscratchpad", INTEGER, &floatscratchpad }, { "altbar", INTEGER, &altbar }, { "mfact", FLOAT, &mfact }, + { "lowestmfact", FLOAT, &lowestmfact }, /* value in .Xresources type value in speedwm */ };