Merge pull request #21 from mchackorg/focus-color
Add support to change focused window's border color
This commit is contained in:
commit
5248efd407
@ -3,6 +3,7 @@ static const int sloppyfocus = 1; /* focus follows mouse */
|
|||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
||||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
||||||
|
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
11
dwl.c
11
dwl.c
@ -1138,7 +1138,8 @@ render(struct wlr_surface *surface, int sx, int sy, void *data)
|
|||||||
void
|
void
|
||||||
renderclients(Monitor *m, struct timespec *now)
|
renderclients(Monitor *m, struct timespec *now)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c, *sel = selclient();
|
||||||
|
const float *color;
|
||||||
double ox, oy;
|
double ox, oy;
|
||||||
int i, w, h;
|
int i, w, h;
|
||||||
struct render_data rdata;
|
struct render_data rdata;
|
||||||
@ -1164,9 +1165,15 @@ renderclients(Monitor *m, struct timespec *now)
|
|||||||
{ox + c->bw + w, oy + c->bw, c->bw, h}, /* right */
|
{ox + c->bw + w, oy + c->bw, c->bw, h}, /* right */
|
||||||
{ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */
|
{ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (c == sel)
|
||||||
|
color = focuscolor;
|
||||||
|
else
|
||||||
|
color = bordercolor;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
scalebox(&borders[i], m->wlr_output->scale);
|
scalebox(&borders[i], m->wlr_output->scale);
|
||||||
wlr_render_rect(drw, &borders[i], bordercolor,
|
wlr_render_rect(drw, &borders[i], color,
|
||||||
m->wlr_output->transform_matrix);
|
m->wlr_output->transform_matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user