hopefully add status2d + statuspadding patch
This commit is contained in:
parent
8544c7acda
commit
cb39969a36
6 changed files with 171 additions and 12 deletions
|
@ -15,6 +15,8 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display
|
|||
static const int showsystray = 1; /* 0 means no systray */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||
static const int vertpadbar = 0; /* vertical padding for statusbar */
|
||||
static const char *fonts[] = { "JetBrainsMono NF:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
//static const char col_gray1[] = "#222222";
|
||||
|
|
|
@ -23,16 +23,18 @@ static const char col_gray2[] = "#444444";
|
|||
static const char col_gray3[] = "#cccccc";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#770000";
|
||||
static const char col_red[] = "#5E3737";
|
||||
static const char col_red_dark[] = "#4D1111";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
[SchemeNorm] = { col_gray3, col_red, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_red_dark, col_cyan },
|
||||
};
|
||||
|
||||
static const char *const autostart[] = {
|
||||
"/home/sako/.dwmscripts/bar.sh", NULL,
|
||||
"xsetroot", "-cursor_name", "Catppuccin-Mocha-Dark", NULL,
|
||||
"feh", "--bg-scale", "/home/sako/.config/bspwm/background.png", NULL,
|
||||
"dwmblocks", NULL,
|
||||
"nm-applet", NULL,
|
||||
"blueman-applet", NULL,
|
||||
"keepassxc", NULL,
|
||||
|
@ -111,6 +113,22 @@ static const Key keys[] = {
|
|||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_p, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_p, togglefloating, {0} },
|
||||
{ MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
|
||||
{ MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
|
||||
{ MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
|
||||
{ MODKEY, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
|
||||
{ MODKEY|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
|
||||
{ MODKEY|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
|
||||
{ MODKEY|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
|
||||
{ MODKEY|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
|
||||
{ MODKEY|ControlMask, XK_Up, moveresizeedge, {.v = "t"} },
|
||||
{ MODKEY|ControlMask, XK_Down, moveresizeedge, {.v = "b"} },
|
||||
{ MODKEY|ControlMask, XK_Left, moveresizeedge, {.v = "l"} },
|
||||
{ MODKEY|ControlMask, XK_Right, moveresizeedge, {.v = "r"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_Up, moveresizeedge, {.v = "T"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_Down, moveresizeedge, {.v = "B"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_Left, moveresizeedge, {.v = "L"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_Right, moveresizeedge, {.v = "R"} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
|
|
11
config/dwm/config.def.h.rej
Normal file
11
config/dwm/config.def.h.rej
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- config.def.h
|
||||
+++ config.def.h
|
||||
@@ -7,6 +7,8 @@ static const unsigned int gappx = 10; /* default gap between windows i
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||
+static const int vertpadbar = 0; /* vertical padding for statusbar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
|
@ -862,7 +862,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
|
|||
isCode = 0;
|
||||
text = p;
|
||||
|
||||
w += 2; /* 1px padding on both sides */
|
||||
w += horizpadbar; /* padding with status2d */
|
||||
ret = m->ww - w;
|
||||
x = ret - getsystraywidth();
|
||||
|
||||
|
@ -870,7 +870,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
|
|||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
x++;
|
||||
x += horizpadbar / 2; /* padding with status2d */
|
||||
|
||||
/* process status text */
|
||||
i = -1;
|
||||
|
@ -2061,7 +2061,7 @@ setup(void)
|
|||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
bh = drw->fonts->h + 2;
|
||||
bh = drw->fonts->h + vertpadbar;
|
||||
updategeom();
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
|
|
|
@ -185,6 +185,7 @@ static void detachstack(Client *c);
|
|||
static Monitor *dirtomon(int dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
static int drawstatusbar(Monitor *m, int bh, char* text);
|
||||
static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
|
@ -273,7 +274,7 @@ static void autostart_exec(void);
|
|||
/* variables */
|
||||
static Systray *systray = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static char stext[1024];
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh; /* bar height */
|
||||
|
@ -559,7 +560,7 @@ cleanup(void)
|
|||
|
||||
for (i = 0; i < CurLast; i++)
|
||||
drw_cur_free(drw, cursor[i]);
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
for (i = 0; i < LENGTH(colors) + 1; i++)
|
||||
free(scheme[i]);
|
||||
free(scheme);
|
||||
XDestroyWindow(dpy, wmcheckwin);
|
||||
|
@ -823,6 +824,115 @@ dirtomon(int dir)
|
|||
return m;
|
||||
}
|
||||
|
||||
int
|
||||
drawstatusbar(Monitor *m, int bh, char* stext) {
|
||||
int ret, i, w, x, len;
|
||||
short isCode = 0;
|
||||
char *text;
|
||||
char *p;
|
||||
|
||||
len = strlen(stext) + 1 ;
|
||||
if (!(text = (char*) malloc(sizeof(char)*len)))
|
||||
die("malloc");
|
||||
p = text;
|
||||
memcpy(text, stext, len);
|
||||
|
||||
/* compute width of the status text */
|
||||
w = 0;
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^') {
|
||||
if (!isCode) {
|
||||
isCode = 1;
|
||||
text[i] = '\0';
|
||||
w += TEXTW(text) - lrpad;
|
||||
text[i] = '^';
|
||||
if (text[++i] == 'f')
|
||||
w += atoi(text + ++i);
|
||||
} else {
|
||||
isCode = 0;
|
||||
text = text + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isCode)
|
||||
w += TEXTW(text) - lrpad;
|
||||
else
|
||||
isCode = 0;
|
||||
text = p;
|
||||
|
||||
w += 2; /* 1px padding on both sides */
|
||||
ret = m->ww - w;
|
||||
x = ret - getsystraywidth();
|
||||
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
x++;
|
||||
|
||||
/* process status text */
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^' && !isCode) {
|
||||
isCode = 1;
|
||||
|
||||
text[i] = '\0';
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
|
||||
x += w;
|
||||
|
||||
/* process code */
|
||||
while (text[++i] != '^') {
|
||||
if (text[i] == 'c') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColFg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'b') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColBg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'd') {
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
} else if (text[i] == 'r') {
|
||||
int rx = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int ry = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rw = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rh = atoi(text + ++i);
|
||||
|
||||
drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
|
||||
} else if (text[i] == 'f') {
|
||||
x += atoi(text + ++i);
|
||||
}
|
||||
}
|
||||
|
||||
text = text + i + 1;
|
||||
i=-1;
|
||||
isCode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCode) {
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
}
|
||||
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
free(p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
|
@ -840,9 +950,7 @@ drawbar(Monitor *m)
|
|||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px extra right padding */
|
||||
drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
|
||||
tw = m->ww - drawstatusbar(m, bh, stext);
|
||||
}
|
||||
|
||||
resizebarwin(m);
|
||||
|
@ -1982,7 +2090,8 @@ setup(void)
|
|||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||
/* init appearance */
|
||||
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||
scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *));
|
||||
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);
|
||||
/* init system tray */
|
||||
|
|
19
config/dwm/dwm.c.rej
Normal file
19
config/dwm/dwm.c.rej
Normal file
|
@ -0,0 +1,19 @@
|
|||
--- dwm.c
|
||||
+++ dwm.c
|
||||
@@ -740,14 +740,14 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
|
||||
isCode = 0;
|
||||
text = p;
|
||||
|
||||
- w += 2; /* 1px padding on both sides */
|
||||
+ w += horizpadbar;
|
||||
ret = x = m->ww - w;
|
||||
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
- x++;
|
||||
+ x += horizpadbar / 2;
|
||||
|
||||
/* process status text */
|
||||
i = -1;
|
Loading…
Reference in a new issue