mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding vtcolors patch
This commit is contained in:
parent
9ef44a0bc1
commit
4b45c6071f
@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
2020-02-11 - Added swaptags patch
|
2020-02-11 - Added swaptags and vtcolor patches
|
||||||
|
|
||||||
2020-02-09 - Added alternative scratchpad patch
|
2020-02-09 - Added alternative scratchpad patch
|
||||||
|
|
||||||
@ -373,6 +373,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
- [viewontag](https://dwm.suckless.org/patches/viewontag/)
|
- [viewontag](https://dwm.suckless.org/patches/viewontag/)
|
||||||
- follow a window to the tag it is being moved to
|
- follow a window to the tag it is being moved to
|
||||||
|
|
||||||
|
- [vtcolor](https://dwm.suckless.org/patches/vtcolors/)
|
||||||
|
- this patch adds the ability for dwm to read colors from the linux virtual console essentially allowing you to use the same color scheme as your regular tty
|
||||||
|
|
||||||
- [warp](https://dwm.suckless.org/patches/warp/)
|
- [warp](https://dwm.suckless.org/patches/warp/)
|
||||||
- warps the mouse cursor to the center of the currently focused window or screen when the mouse cursor is (a) on a different screen or (b) on top of a different window
|
- warps the mouse cursor to the center of the currently focused window or screen when the mouse cursor is (a) on a different screen or (b) on top of a different window
|
||||||
|
|
||||||
|
104
config.def.h
104
config.def.h
@ -44,13 +44,16 @@ static const char dmenufont[] = "monospace:size=10";
|
|||||||
|
|
||||||
static char normfgcolor[] = "#bbbbbb";
|
static char normfgcolor[] = "#bbbbbb";
|
||||||
static char normbgcolor[] = "#222222";
|
static char normbgcolor[] = "#222222";
|
||||||
|
#if !VTCOLORS_PATCH
|
||||||
static char normbordercolor[] = "#444444";
|
static char normbordercolor[] = "#444444";
|
||||||
#if FLOAT_BORDER_COLOR_PATCH
|
#if FLOAT_BORDER_COLOR_PATCH
|
||||||
static char normfloatcolor[] = "#db8fd9";
|
static char normfloatcolor[] = "#db8fd9";
|
||||||
#endif // FLOAT_BORDER_COLOR_PATCH
|
#endif // FLOAT_BORDER_COLOR_PATCH
|
||||||
|
#endif // !VTCOLORS_PATCH
|
||||||
|
|
||||||
static char selfgcolor[] = "#eeeeee";
|
static char selfgcolor[] = "#eeeeee";
|
||||||
static char selbgcolor[] = "#005577";
|
static char selbgcolor[] = "#005577";
|
||||||
|
#if !VTCOLORS_PATCH
|
||||||
static char selbordercolor[] = "#005577";
|
static char selbordercolor[] = "#005577";
|
||||||
#if FLOAT_BORDER_COLOR_PATCH
|
#if FLOAT_BORDER_COLOR_PATCH
|
||||||
static char selfloatcolor[] = "#005577";
|
static char selfloatcolor[] = "#005577";
|
||||||
@ -91,6 +94,7 @@ static char titlebordercolor[] = "#005577";
|
|||||||
static char titlefloatcolor[] = "#005577";
|
static char titlefloatcolor[] = "#005577";
|
||||||
#endif // FLOAT_BORDER_COLOR_PATCH
|
#endif // FLOAT_BORDER_COLOR_PATCH
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // TITLECOLOR_PATCH
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
|
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
static const unsigned int baralpha = 0xd0;
|
static const unsigned int baralpha = 0xd0;
|
||||||
@ -108,12 +112,100 @@ static const unsigned int alphas[][3] = {
|
|||||||
#if AWESOMEBAR_PATCH
|
#if AWESOMEBAR_PATCH
|
||||||
[SchemeHid] = { OPAQUE, baralpha, borderalpha },
|
[SchemeHid] = { OPAQUE, baralpha, borderalpha },
|
||||||
#endif // AWESOMEBAR_PATCH
|
#endif // AWESOMEBAR_PATCH
|
||||||
#if TITLECOLOR_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
[SchemeTagsNorm] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
[SchemeTagsSel] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
[SchemeTitleNorm] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
[SchemeTitleSel] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
[SchemeStatus] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
#elif TITLECOLOR_PATCH
|
||||||
[SchemeTitle] = { OPAQUE, baralpha, borderalpha },
|
[SchemeTitle] = { OPAQUE, baralpha, borderalpha },
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // VTCOLORS_PATCH / TITLECOLOR_PATCH
|
||||||
};
|
};
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
#if FLOAT_BORDER_COLOR_PATCH
|
#if VTCOLORS_PATCH && FLOAT_BORDER_COLOR_PATCH
|
||||||
|
static const char title_bg_dark[] = "#303030";
|
||||||
|
static const char title_bg_light[] = "#fdfdfd";
|
||||||
|
static const int color_ptrs[][4] = {
|
||||||
|
/* fg bg border float */
|
||||||
|
[SchemeNorm] = { -1, -1, 5, 12 },
|
||||||
|
[SchemeSel] = { -1, -1, 11, 13 },
|
||||||
|
#if STATUSCOLORS_PATCH
|
||||||
|
[SchemeWarn] = { -1, 1, 1, 14 },
|
||||||
|
#endif // STATUSCOLORS_PATCH
|
||||||
|
#if URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
[SchemeUrg] = { 7, 9, 9, 15 },
|
||||||
|
#endif // URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
#if AWESOMEBAR_PATCH
|
||||||
|
[SchemeHid] = { 5, 0, 0, -1 },
|
||||||
|
#endif // AWESOMEBAR_PATCH
|
||||||
|
[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[][4][8] = {
|
||||||
|
/* fg bg border float */
|
||||||
|
[SchemeNorm] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeSel] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
#if STATUSCOLORS_PATCH
|
||||||
|
[SchemeWarn] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
#endif // STATUSCOLORS_PATCH
|
||||||
|
#if URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
[SchemeUrg] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
#endif // URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
#if AWESOMEBAR_PATCH
|
||||||
|
[SchemeHid] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
#endif // AWESOMEBAR_PATCH
|
||||||
|
[SchemeTagsNorm] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTagsSel] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTitleNorm] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTitleSel] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeStatus] = { "#000000", "#000000", "#000000", "#000000" },
|
||||||
|
};
|
||||||
|
#elif VTCOLORS_PATCH
|
||||||
|
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 },
|
||||||
|
#if STATUSCOLORS_PATCH
|
||||||
|
[SchemeWarn] = { -1, 1, 1 },
|
||||||
|
#endif // STATUSCOLORS_PATCH
|
||||||
|
#if URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
[SchemeUrg] = { 7, 9, 9 },
|
||||||
|
#endif // URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
#if AWESOMEBAR_PATCH
|
||||||
|
[SchemeHid] = { 5, 0, 0 },
|
||||||
|
#endif // AWESOMEBAR_PATCH
|
||||||
|
[SchemeTagsNorm] = { 2, 0, 0 },
|
||||||
|
[SchemeTagsSel] = { 6, 5, 5 },
|
||||||
|
[SchemeTitleNorm] = { 6, -1, -1 },
|
||||||
|
[SchemeTitleSel] = { 6, -1, -1 },
|
||||||
|
[SchemeStatus] = { 2, 0, 0 },
|
||||||
|
};
|
||||||
|
static char colors[][3][8] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeSel] = { "#000000", "#000000", "#000000" },
|
||||||
|
#if STATUSCOLORS_PATCH
|
||||||
|
[SchemeWarn] = { "#000000", "#000000", "#000000" },
|
||||||
|
#endif // STATUSCOLORS_PATCH
|
||||||
|
#if URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
[SchemeUrg] = { "#000000", "#000000", "#000000" },
|
||||||
|
#endif // URGENTBORDER_PATCH || STATUSCOLORS_PATCH
|
||||||
|
#if AWESOMEBAR_PATCH
|
||||||
|
[SchemeHid] = { "#000000", "#000000", "#000000" },
|
||||||
|
#endif // AWESOMEBAR_PATCH
|
||||||
|
[SchemeTagsNorm] = { "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTagsSel] = { "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTitleNorm] = { "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeTitleSel] = { "#000000", "#000000", "#000000" },
|
||||||
|
[SchemeStatus] = { "#000000", "#000000", "#000000" },
|
||||||
|
};
|
||||||
|
#elif FLOAT_BORDER_COLOR_PATCH
|
||||||
static
|
static
|
||||||
#if !XRDB_PATCH
|
#if !XRDB_PATCH
|
||||||
const
|
const
|
||||||
@ -135,7 +227,7 @@ char *colors[][4] = {
|
|||||||
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor, titlefloatcolor },
|
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor, titlefloatcolor },
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // TITLECOLOR_PATCH
|
||||||
};
|
};
|
||||||
#else
|
#else // !VTCOLORS_PATCH && !FLOAT_BORDER_COLOR_PATCH
|
||||||
static
|
static
|
||||||
#if !XRDB_PATCH
|
#if !XRDB_PATCH
|
||||||
const
|
const
|
||||||
@ -157,7 +249,7 @@ char *colors[][3] = {
|
|||||||
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor },
|
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor },
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // TITLECOLOR_PATCH
|
||||||
};
|
};
|
||||||
#endif // FLOAT_BORDER_COLOR_PATCH
|
#endif // VTCOLORS_PATCH / FLOAT_BORDER_COLOR_PATCH
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
#if EWMHTAGS_PATCH
|
#if EWMHTAGS_PATCH
|
||||||
@ -671,7 +763,7 @@ static Key keys[] = {
|
|||||||
#if WINVIEW_PATCH
|
#if WINVIEW_PATCH
|
||||||
{ MODKEY, XK_o, winview, {0} },
|
{ MODKEY, XK_o, winview, {0} },
|
||||||
#endif // WINVIEW_PATCH
|
#endif // WINVIEW_PATCH
|
||||||
#if XRDB_PATCH
|
#if XRDB_PATCH && !VTCOLORS_PATCH
|
||||||
{ MODKEY|ShiftMask, XK_F5, xrdb, {.v = NULL } },
|
{ MODKEY|ShiftMask, XK_F5, xrdb, {.v = NULL } },
|
||||||
#endif // XRDB_PATCH
|
#endif // XRDB_PATCH
|
||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
20
drw.c
20
drw.c
@ -211,12 +211,18 @@ drw_fontset_free(Fnt *font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
#if ALPHA_PATCH
|
drw_clr_create(
|
||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
|
Drw *drw,
|
||||||
|
Clr *dest,
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
const char clrname[]
|
||||||
#else
|
#else
|
||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
const char *clrname
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
|
#if ALPHA_PATCH
|
||||||
|
, unsigned int alpha
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
{
|
) {
|
||||||
if (!drw || !dest || !clrname)
|
if (!drw || !dest || !clrname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -239,11 +245,13 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
|||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(
|
drw_scm_create(
|
||||||
Drw *drw,
|
Drw *drw,
|
||||||
#if XRDB_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
char clrnames[][8],
|
||||||
|
#elif XRDB_PATCH
|
||||||
char *clrnames[],
|
char *clrnames[],
|
||||||
#else
|
#else
|
||||||
const char *clrnames[],
|
const char *clrnames[],
|
||||||
#endif // XRDB_PATCH
|
#endif // VTCOLORS_PATCH / XRDB_PATCH
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
const unsigned int alphas[],
|
const unsigned int alphas[],
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
|
10
drw.h
10
drw.h
@ -54,18 +54,24 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in
|
|||||||
void drw_clr_create(
|
void drw_clr_create(
|
||||||
Drw *drw,
|
Drw *drw,
|
||||||
Clr *dest,
|
Clr *dest,
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
const char clrname[]
|
||||||
|
#else
|
||||||
const char *clrname
|
const char *clrname
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
, unsigned int alpha
|
, unsigned int alpha
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
);
|
);
|
||||||
Clr *drw_scm_create(
|
Clr *drw_scm_create(
|
||||||
Drw *drw,
|
Drw *drw,
|
||||||
#if XRDB_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
char clrnames[][8],
|
||||||
|
#elif XRDB_PATCH
|
||||||
char *clrnames[],
|
char *clrnames[],
|
||||||
#else
|
#else
|
||||||
const char *clrnames[],
|
const char *clrnames[],
|
||||||
#endif // XRDB_PATCH
|
#endif // VTCOLORS_PATCH / XRDB_PATCH
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
const unsigned int alphas[],
|
const unsigned int alphas[],
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
|
89
dwm.c
89
dwm.c
@ -93,9 +93,15 @@ enum {
|
|||||||
#if AWESOMEBAR_PATCH
|
#if AWESOMEBAR_PATCH
|
||||||
,SchemeHid
|
,SchemeHid
|
||||||
#endif // AWESOMEBAR_PATCH
|
#endif // AWESOMEBAR_PATCH
|
||||||
#if TITLECOLOR_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
,SchemeTagsNorm
|
||||||
|
,SchemeTagsSel
|
||||||
|
,SchemeTitleNorm
|
||||||
|
,SchemeTitleSel
|
||||||
|
,SchemeStatus
|
||||||
|
#elif TITLECOLOR_PATCH
|
||||||
,SchemeTitle
|
,SchemeTitle
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // VTCOLORS_PATCH
|
||||||
}; /* color schemes */
|
}; /* color schemes */
|
||||||
|
|
||||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
@ -1359,7 +1365,11 @@ drawbar(Monitor *m)
|
|||||||
#if !STATUSALLMONS_PATCH
|
#if !STATUSALLMONS_PATCH
|
||||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
#endif // STATUSALLMONS_PATCH
|
#endif // STATUSALLMONS_PATCH
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeStatus]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
#if STATUSPADDING_PATCH
|
#if STATUSPADDING_PATCH
|
||||||
sw = TEXTW(stext);
|
sw = TEXTW(stext);
|
||||||
#else
|
#else
|
||||||
@ -1405,7 +1415,11 @@ drawbar(Monitor *m)
|
|||||||
x = 0;
|
x = 0;
|
||||||
#if LEFTLAYOUT_PATCH
|
#if LEFTLAYOUT_PATCH
|
||||||
w = blw = TEXTW(m->ltsymbol);
|
w = blw = TEXTW(m->ltsymbol);
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
#endif // LEFTLAYOUT_PATCH
|
#endif // LEFTLAYOUT_PATCH
|
||||||
#if TAGGRID_PATCH
|
#if TAGGRID_PATCH
|
||||||
@ -1428,9 +1442,19 @@ drawbar(Monitor *m)
|
|||||||
#endif // ALTERNATIVE_TAGS_PATCH
|
#endif // ALTERNATIVE_TAGS_PATCH
|
||||||
#if URGENTBORDER_PATCH
|
#if URGENTBORDER_PATCH
|
||||||
if (m->tagset[m->seltags] & 1 << i)
|
if (m->tagset[m->seltags] & 1 << i)
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTagsSel]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeSel]);
|
drw_setscheme(drw, scheme[SchemeSel]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
else
|
else
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[urg & 1 << i ? SchemeUrg : SchemeTagsNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[urg & 1 << i ? SchemeUrg : SchemeNorm]);
|
drw_setscheme(drw, scheme[urg & 1 << i ? SchemeUrg : SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
|
#elif VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]);
|
||||||
#else // URGENTBORDER_PATCH
|
#else // URGENTBORDER_PATCH
|
||||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
#endif // URGENTBORDER_PATCH
|
#endif // URGENTBORDER_PATCH
|
||||||
@ -1457,7 +1481,11 @@ drawbar(Monitor *m)
|
|||||||
#endif // TAGGRID_PATCH
|
#endif // TAGGRID_PATCH
|
||||||
#if !LEFTLAYOUT_PATCH
|
#if !LEFTLAYOUT_PATCH
|
||||||
w = blw = TEXTW(m->ltsymbol);
|
w = blw = TEXTW(m->ltsymbol);
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
#endif // LEFTLAYOUT_PATCH
|
#endif // LEFTLAYOUT_PATCH
|
||||||
|
|
||||||
@ -1469,22 +1497,32 @@ drawbar(Monitor *m)
|
|||||||
if (!ISVISIBLE(c))
|
if (!ISVISIBLE(c))
|
||||||
continue;
|
continue;
|
||||||
if (m->sel == c)
|
if (m->sel == c)
|
||||||
#if TITLECOLOR_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
scm = SchemeTitleSel;
|
||||||
|
#elif TITLECOLOR_PATCH
|
||||||
scm = SchemeTitle;
|
scm = SchemeTitle;
|
||||||
#else
|
#else
|
||||||
scm = SchemeSel;
|
scm = SchemeSel;
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // VTCOLORS_PATCH / TITLECOLOR_PATCH
|
||||||
else if (HIDDEN(c))
|
else if (HIDDEN(c))
|
||||||
scm = SchemeHid;
|
scm = SchemeHid;
|
||||||
else
|
else
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
scm = SchemeTitleNorm;
|
||||||
|
#else
|
||||||
scm = SchemeNorm;
|
scm = SchemeNorm;
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
|
|
||||||
drw_setscheme(drw, scheme[scm]);
|
drw_setscheme(drw, scheme[scm]);
|
||||||
drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
|
drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
|
||||||
x += (1.0 / (double)n) * w;
|
x += (1.0 / (double)n) * w;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
}
|
}
|
||||||
#elif FANCYBAR_PATCH
|
#elif FANCYBAR_PATCH
|
||||||
@ -1510,11 +1548,13 @@ drawbar(Monitor *m)
|
|||||||
continue;
|
continue;
|
||||||
tw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
tw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
||||||
|
|
||||||
#if TITLECOLOR_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[m->sel == c ? SchemeTitleSel : SchemeTitleNorm]);
|
||||||
|
#elif TITLECOLOR_PATCH
|
||||||
drw_setscheme(drw, scheme[m->sel == c ? SchemeTitle : SchemeNorm]);
|
drw_setscheme(drw, scheme[m->sel == c ? SchemeTitle : SchemeNorm]);
|
||||||
#else
|
#else
|
||||||
drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // VTCOLORS_PATCH / TITLECOLOR_PATCH
|
||||||
if (tw > 0) /* trap special handling of 0 in drw_text */
|
if (tw > 0) /* trap special handling of 0 in drw_text */
|
||||||
drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
|
drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
|
||||||
#if !HIDEVACANTTAGS_PATCH
|
#if !HIDEVACANTTAGS_PATCH
|
||||||
@ -1529,15 +1569,21 @@ drawbar(Monitor *m)
|
|||||||
w -= tw;
|
w -= tw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
#else
|
#else
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
#if TITLECOLOR_PATCH
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
||||||
|
#elif TITLECOLOR_PATCH
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]);
|
drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]);
|
||||||
#else
|
#else
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
#endif // TITLECOLOR_PATCH
|
#endif // VTCOLORS_PATCH / TITLECOLOR_PATCH
|
||||||
#if IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
#if IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
#endif // IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
#endif // IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||||
@ -1568,7 +1614,11 @@ drawbar(Monitor *m)
|
|||||||
#endif // ACTIVETAGINDICATORBAR_PATCH
|
#endif // ACTIVETAGINDICATORBAR_PATCH
|
||||||
#endif // HIDEVACANTTAGS_PATCH
|
#endif // HIDEVACANTTAGS_PATCH
|
||||||
} else {
|
} else {
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
#if BARPADDING_PATCH
|
#if BARPADDING_PATCH
|
||||||
drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
||||||
#else
|
#else
|
||||||
@ -1585,7 +1635,11 @@ drawbar(Monitor *m)
|
|||||||
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||||
#if EXTRABAR_PATCH
|
#if EXTRABAR_PATCH
|
||||||
if (m == selmon) { /* extra status is only drawn on selected monitor */
|
if (m == selmon) { /* extra status is only drawn on selected monitor */
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||||
|
#else
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
drw_text(drw, 0, 0, mons->ww, bh, 0, estext, 0);
|
drw_text(drw, 0, 0, mons->ww, bh, 0, estext, 0);
|
||||||
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
||||||
}
|
}
|
||||||
@ -2922,6 +2976,16 @@ setup(void)
|
|||||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||||
/* init appearance */
|
/* init appearance */
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
get_vt_colors();
|
||||||
|
if (get_luminance(colors[SchemeTagsNorm][ColBg]) > 50) {
|
||||||
|
strcpy(colors[SchemeTitleNorm][ColBg], title_bg_light);
|
||||||
|
strcpy(colors[SchemeTitleSel][ColBg], title_bg_light);
|
||||||
|
} else {
|
||||||
|
strcpy(colors[SchemeTitleNorm][ColBg], title_bg_dark);
|
||||||
|
strcpy(colors[SchemeTitleSel][ColBg], title_bg_dark);
|
||||||
|
}
|
||||||
|
#endif // VTCOLORS_PATCH
|
||||||
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||||
for (i = 0; i < LENGTH(colors); i++)
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
scheme[i] = drw_scm_create(drw, colors[i],
|
scheme[i] = drw_scm_create(drw, colors[i],
|
||||||
@ -3983,6 +4047,7 @@ main(int argc, char *argv[])
|
|||||||
die(help());
|
die(help());
|
||||||
else if (!strcmp("-fn", argv[i])) /* font set */
|
else if (!strcmp("-fn", argv[i])) /* font set */
|
||||||
fonts[0] = argv[++i];
|
fonts[0] = argv[++i];
|
||||||
|
#if !VTCOLORS_PATCH
|
||||||
else if (!strcmp("-nb", argv[i])) /* normal background color */
|
else if (!strcmp("-nb", argv[i])) /* normal background color */
|
||||||
colors[SchemeNorm][1] = argv[++i];
|
colors[SchemeNorm][1] = argv[++i];
|
||||||
else if (!strcmp("-nf", argv[i])) /* normal foreground color */
|
else if (!strcmp("-nf", argv[i])) /* normal foreground color */
|
||||||
@ -3991,6 +4056,7 @@ main(int argc, char *argv[])
|
|||||||
colors[SchemeSel][1] = argv[++i];
|
colors[SchemeSel][1] = argv[++i];
|
||||||
else if (!strcmp("-sf", argv[i])) /* selected foreground color */
|
else if (!strcmp("-sf", argv[i])) /* selected foreground color */
|
||||||
colors[SchemeSel][0] = argv[++i];
|
colors[SchemeSel][0] = argv[++i];
|
||||||
|
#endif // !VTCOLORS_PATCH
|
||||||
#if NODMENU_PATCH
|
#if NODMENU_PATCH
|
||||||
else if (!strcmp("-df", argv[i])) /* dmenu font */
|
else if (!strcmp("-df", argv[i])) /* dmenu font */
|
||||||
dmenucmd[2] = argv[++i];
|
dmenucmd[2] = argv[++i];
|
||||||
@ -4002,7 +4068,6 @@ main(int argc, char *argv[])
|
|||||||
dmenucmd[8] = argv[++i];
|
dmenucmd[8] = argv[++i];
|
||||||
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
|
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
|
||||||
dmenucmd[10] = argv[++i];
|
dmenucmd[10] = argv[++i];
|
||||||
else die(help());
|
|
||||||
#else
|
#else
|
||||||
else if (!strcmp("-df", argv[i])) /* dmenu font */
|
else if (!strcmp("-df", argv[i])) /* dmenu font */
|
||||||
dmenucmd[4] = argv[++i];
|
dmenucmd[4] = argv[++i];
|
||||||
@ -4014,8 +4079,8 @@ main(int argc, char *argv[])
|
|||||||
dmenucmd[10] = argv[++i];
|
dmenucmd[10] = argv[++i];
|
||||||
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
|
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
|
||||||
dmenucmd[12] = argv[++i];
|
dmenucmd[12] = argv[++i];
|
||||||
else die(help());
|
|
||||||
#endif // NODMENU_PATCH
|
#endif // NODMENU_PATCH
|
||||||
|
else die(help());
|
||||||
#else
|
#else
|
||||||
if (argc == 2 && !strcmp("-v", argv[1]))
|
if (argc == 2 && !strcmp("-v", argv[1]))
|
||||||
die("dwm-"VERSION);
|
die("dwm-"VERSION);
|
||||||
@ -4031,10 +4096,10 @@ main(int argc, char *argv[])
|
|||||||
die("dwm: cannot get xcb connection\n");
|
die("dwm: cannot get xcb connection\n");
|
||||||
#endif // SWALLOW_PATCH
|
#endif // SWALLOW_PATCH
|
||||||
checkotherwm();
|
checkotherwm();
|
||||||
#if XRDB_PATCH
|
#if XRDB_PATCH && !VTCOLORS_PATCH
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
loadxrdb();
|
loadxrdb();
|
||||||
#endif
|
#endif // XRDB_PATCH && !VTCOLORS_PATCH
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
|
@ -146,6 +146,9 @@
|
|||||||
#if VANITYGAPS_PATCH
|
#if VANITYGAPS_PATCH
|
||||||
#include "vanitygaps.c"
|
#include "vanitygaps.c"
|
||||||
#endif
|
#endif
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
#include "vtcolors.c"
|
||||||
|
#endif
|
||||||
#if WARP_PATCH
|
#if WARP_PATCH
|
||||||
#include "warp.c"
|
#include "warp.c"
|
||||||
#endif
|
#endif
|
||||||
@ -155,7 +158,7 @@
|
|||||||
#if ZOOMSWAP_PATCH
|
#if ZOOMSWAP_PATCH
|
||||||
#include "zoomswap.c"
|
#include "zoomswap.c"
|
||||||
#endif
|
#endif
|
||||||
#if XRDB_PATCH
|
#if XRDB_PATCH && !VTCOLORS_PATCH
|
||||||
#include "xrdb.c"
|
#include "xrdb.c"
|
||||||
#endif
|
#endif
|
||||||
/* Layouts */
|
/* Layouts */
|
||||||
|
@ -146,6 +146,9 @@
|
|||||||
#if VANITYGAPS_PATCH
|
#if VANITYGAPS_PATCH
|
||||||
#include "vanitygaps.h"
|
#include "vanitygaps.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if VTCOLORS_PATCH
|
||||||
|
#include "vtcolors.h"
|
||||||
|
#endif
|
||||||
#if WARP_PATCH
|
#if WARP_PATCH
|
||||||
#include "warp.h"
|
#include "warp.h"
|
||||||
#endif
|
#endif
|
||||||
@ -155,7 +158,7 @@
|
|||||||
#if ZOOMSWAP_PATCH
|
#if ZOOMSWAP_PATCH
|
||||||
#include "zoomswap.h"
|
#include "zoomswap.h"
|
||||||
#endif
|
#endif
|
||||||
#if XRDB_PATCH
|
#if XRDB_PATCH && !VTCOLORS_PATCH
|
||||||
#include "xrdb.h"
|
#include "xrdb.h"
|
||||||
#endif
|
#endif
|
||||||
/* Layouts */
|
/* Layouts */
|
||||||
|
70
patch/vtcolors.c
Normal file
70
patch/vtcolors.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
void
|
||||||
|
get_vt_colors(void)
|
||||||
|
{
|
||||||
|
char *cfs[3] = {
|
||||||
|
"/sys/module/vt/parameters/default_red",
|
||||||
|
"/sys/module/vt/parameters/default_grn",
|
||||||
|
"/sys/module/vt/parameters/default_blu",
|
||||||
|
};
|
||||||
|
char vtcs[16][8];
|
||||||
|
char tk[] = ",";
|
||||||
|
char cl[64];
|
||||||
|
char *tp = NULL;
|
||||||
|
FILE *fp;
|
||||||
|
size_t r;
|
||||||
|
int i, c, n;
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
strcpy(vtcs[i], "#000000");
|
||||||
|
|
||||||
|
for (i = 0, r = 0; i < 3; i++) {
|
||||||
|
if ((fp = fopen(cfs[i], "r")) == NULL)
|
||||||
|
continue;
|
||||||
|
while ((cl[r] = fgetc(fp)) != EOF && cl[r] != '\n')
|
||||||
|
r++;
|
||||||
|
cl[r] = '\0';
|
||||||
|
for (c = 0, tp = cl, n = 0; c < 16; c++, tp++) {
|
||||||
|
if ((r = strcspn(tp, tk)) == -1)
|
||||||
|
break;
|
||||||
|
for (n = 0; r && *tp >= 48 && *tp < 58; r--, tp++)
|
||||||
|
n = n * 10 - 48 + *tp;
|
||||||
|
vtcs[c][i * 2 + 1] = n / 16 < 10 ? n / 16 + 48 : n / 16 + 87;
|
||||||
|
vtcs[c][i * 2 + 2] = n % 16 < 10 ? n % 16 + 48 : n % 16 + 87;
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
for (i = 0; i < LENGTH(colors); i++) {
|
||||||
|
#if FLOAT_BORDER_COLOR_PATCH
|
||||||
|
for (c = 0; c < 4; c++)
|
||||||
|
#else
|
||||||
|
for (c = 0; c < 3; c++)
|
||||||
|
#endif // FLOAT_BORDER_COLOR_PATCH
|
||||||
|
{
|
||||||
|
n = color_ptrs[i][c];
|
||||||
|
if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
|
||||||
|
memcpy(colors[i][c], vtcs[n], 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_luminance(char *r)
|
||||||
|
{
|
||||||
|
char *c = r;
|
||||||
|
int n[3] = {0};
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (*c) {
|
||||||
|
if (*c >= 48 && *c < 58)
|
||||||
|
n[i / 2] = n[i / 2] * 16 - 48 + *c;
|
||||||
|
else if (*c >= 65 && *c < 71)
|
||||||
|
n[i / 2] = n[i / 2] * 16 - 55 + *c;
|
||||||
|
else if (*c >= 97 && *c < 103)
|
||||||
|
n[i / 2] = n[i / 2] * 16 - 87 + *c;
|
||||||
|
else
|
||||||
|
i--;
|
||||||
|
i++;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
|
||||||
|
}
|
2
patch/vtcolors.h
Normal file
2
patch/vtcolors.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
static void get_vt_colors(void);
|
||||||
|
static int get_luminance(char *rgb);
|
@ -585,6 +585,13 @@
|
|||||||
*/
|
*/
|
||||||
#define VIEWONTAG_PATCH 0
|
#define VIEWONTAG_PATCH 0
|
||||||
|
|
||||||
|
/* This patch adds the ability for dwm to read colors from the linux virtual console.
|
||||||
|
* /sys/module/vt/parameters/default_{red,grn,blu}
|
||||||
|
* Essentially this way the colors you use in your regular tty is "mirrored" to dwm.
|
||||||
|
* https://dwm.suckless.org/patches/vtcolors/
|
||||||
|
*/
|
||||||
|
#define VTCOLORS_PATCH 0
|
||||||
|
|
||||||
/* This patch warps the mouse cursor to the center of the currently focused window or screen
|
/* This patch warps the mouse cursor to the center of the currently focused window or screen
|
||||||
* when the mouse cursor is (a) on a different screen or (b) on top of a different window.
|
* when the mouse cursor is (a) on a different screen or (b) on top of a different window.
|
||||||
* https://dwm.suckless.org/patches/warp/
|
* https://dwm.suckless.org/patches/warp/
|
||||||
|
Loading…
Reference in New Issue
Block a user