dwm-noxz

[fork] suckless dwm - personal fork
git clone git://git.noxz.tech/dwm-noxz
Log | Files | Refs | README | LICENSE

commit 3a1916f51b16a776f430a4098bb538e89ec9a787
parent b4b2a5e913a078f3ff89252fd02e0e61ede0e997
Author: Chris Noxz <chris@noxz.tech>
Date:   Tue,  4 Feb 2020 15:14:29 +0100

Apply patch for floating border color

Diffstat:
Mconfig.def.h | 37+++++++++++++++++++------------------
Mdrw.h | 2+-
Mdwm.c | 20++++++++++++++++----
3 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#define COL_DEF "#000000" /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ @@ -14,25 +15,25 @@ static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char title_bg_dark[] = "#303030"; static const char title_bg_light[] = "#fdfdfd"; -static const int color_ptrs[][3] = { - /* fg bg border */ - [SchemeNorm] = { -1, -1, 5 }, - [SchemeSel] = { -1, -1, 11 }, - [SchemeTagsNorm] = { 2, 0, 0 }, - [SchemeTagsSel] = { 6, 5, 5 }, - [SchemeTitleNorm] = { 6, -1, -1 }, - [SchemeTitleSel] = { 6, -1, -1 }, - [SchemeStatus] = { 2, 0, 0 }, +static const int color_ptrs[][4] = { + /* fg bg border float */ + [SchemeNorm] = { -1, -1, 5, 5 }, + [SchemeSel] = { -1, -1, 11, 9 }, + [SchemeTagsNorm] = { 2, 0, 0, -1 }, + [SchemeTagsSel] = { 6, 5, 5, -1 }, + [SchemeTitleNorm] = { 6, -1, -1, -1 }, + [SchemeTitleSel] = { 6, -1, -1, -1 }, + [SchemeStatus] = { 2, 0, 0, -1 }, }; -static char colors[][3][8] = { - /* fg bg border */ - [SchemeNorm] = { "#000000", "#000000", "#000000" }, - [SchemeSel] = { "#000000", "#000000", "#000000" }, - [SchemeTagsNorm] = { "#000000", "#000000", "#000000" }, - [SchemeTagsSel] = { "#000000", "#000000", "#000000" }, - [SchemeTitleNorm] = { "#000000", "#000000", "#000000" }, - [SchemeTitleSel] = { "#000000", "#000000", "#000000" }, - [SchemeStatus] = { "#000000", "#000000", "#000000" }, +static char colors[][4][8] = { + /* fg bg border float */ + [SchemeNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeTagsNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeTagsSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeTitleNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeTitleSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, + [SchemeStatus] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF }, }; /* tagging */ diff --git a/drw.h b/drw.h @@ -12,7 +12,7 @@ typedef struct Fnt { struct Fnt *next; } Fnt; -enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ +enum { ColFg, ColBg, ColBorder, ColFloat }; /* Clr scheme index */ typedef XftColor Clr; typedef struct { diff --git a/dwm.c b/dwm.c @@ -797,7 +797,10 @@ focus(Client *c) detachstack(c); attachstack(c); grabbuttons(c, 1); - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + if (c->isfloating) + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); + else + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); setfocus(c); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -1053,7 +1056,10 @@ manage(Window w, XWindowAttributes *wa) wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); - XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); + if (c->isfloating) + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); + else + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); configure(c); /* propagates border_width, if size doesn't change */ updatewindowtype(c); updatesizehints(c); @@ -1064,6 +1070,8 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); + if (c->isfloating) + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); attach(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, @@ -1564,7 +1572,7 @@ get_vt_colors(void) fclose(fp); } for (i = 0; i < LENGTH(colors); i++) { - for (c = 0; c < 3; c++) { + for (c = 0; c < 4; c++) { n = color_ptrs[i][c]; if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n])) memcpy(colors[i][c], vtcs[n], 7); @@ -1645,7 +1653,7 @@ setup(void) } scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) - scheme[i] = drw_scm_create(drw, colors[i], 3); + scheme[i] = drw_scm_create(drw, colors[i], 4); /* init bars */ updatebars(); updatestatus(); @@ -1790,6 +1798,10 @@ togglefloating(const Arg *arg) return; selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; if (selmon->sel->isfloating) + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColFloat].pixel); + else + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); + if (selmon->sel->isfloating) resize(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h, 0); arrange(selmon);