Skip to content

Commit

Permalink
ltsymbol in block
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenArcher committed Jul 4, 2023
1 parent 96840f8 commit eaa6ac1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 10 additions & 0 deletions dwm-src/config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static const int sidepad = 8; /* horizontal padding of bar */
static const int horizpadbar = 4; /* horizontal padding for statusbar */
static const int vertpadbar = 24; /* vertical padding for statusbar */
static const int barborder = 8; /* (top and bottom) border for status bar */
static const int bargaptl = 16; /* gap between tags and ltsymbol */
static const int bargapli = 16; /* gap between ltsymbol and info bar */
static const char *fonts[] = { "LXGW Wenkai:size=11", "monospace:size=11" };
static const char dmenufont[] = "monospace:size=12";
static const char col_gray1[] = "#22222a";
Expand Down Expand Up @@ -76,6 +78,14 @@ static const Layout layouts[] = {
[LayoutFloat] = { "FLOAT", NULL }, /* no layout function means floating behavior */
};

static const char *layoutcolors[][2] = {
/* fg bg*/
[LayoutTile] = { "#2f2f4f", "#f2f2f4" },
[LayoutMonocle] = { "#2f2f4f", "#f2f2f4" },
[LayoutHorizGrid] = { "#2f2f4f", "#f2f2f4" },
[LayoutFloat] = { "#2f2f4f", "#f2f2f4" },
};

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
Expand Down
16 changes: 14 additions & 2 deletions dwm-src/dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
static Clr **layoutscheme;
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
Expand Down Expand Up @@ -1032,9 +1033,16 @@ drawbar(Monitor *m)
urg & 1 << i);
x += w;
}

x += bargaptl;

w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeTagsNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
drw_setscheme(drw, scheme[SchemeTagsNorm]);
drw_rect(drw, x - bargaptl, 0, w + bargapli + bargaptl, bh, 1, 1);
drw_setscheme(drw, layoutscheme[curlayout]);
x = drw_text(drw, x, vp, w, bh - 2 * vp, lrpad / 2, m->ltsymbol, 0);

x += bargapli;

if ((w = m->ww - tw - stw - x) > bh) {
w -= 2 * sp; // gaps offset
Expand Down Expand Up @@ -2167,6 +2175,10 @@ setup(void)
scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3);
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
layoutscheme = ecalloc(LENGTH(layoutcolors) + 1, sizeof(Clr *));
layoutscheme[LENGTH(layoutcolors)] = drw_scm_create(drw, layoutcolors[0], 2);
for (i = 0; i < LENGTH(layoutcolors); i++)
layoutscheme[i] = drw_scm_create(drw, layoutcolors[i], 2);
/* init system tray */
updatesystray();
/* init bars */
Expand Down

0 comments on commit eaa6ac1

Please sign in to comment.