diff --git a/config/dwm/config.def.h b/config/dwm/config.def.h index 8e113cb0..8b9fdd12 100644 --- a/config/dwm/config.def.h +++ b/config/dwm/config.def.h @@ -15,8 +15,6 @@ 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"; diff --git a/config/dwm/config.def.h.orig b/config/dwm/config.def.h.orig index 8b9fdd12..3c85a130 100644 --- a/config/dwm/config.def.h.orig +++ b/config/dwm/config.def.h.orig @@ -23,18 +23,16 @@ 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_red, col_gray2 }, - [SchemeSel] = { col_gray4, col_red_dark, col_cyan }, + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, 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, @@ -113,22 +111,6 @@ 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 } }, diff --git a/config/dwm/config.def.h.rej b/config/dwm/config.def.h.rej deleted file mode 100644 index 1117863b..00000000 --- a/config/dwm/config.def.h.rej +++ /dev/null @@ -1,11 +0,0 @@ ---- config.def.h -+++ config.def.h -@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ - 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"; diff --git a/config/dwm/dwm.c b/config/dwm/dwm.c index 193414bf..aa3cde64 100644 --- a/config/dwm/dwm.c +++ b/config/dwm/dwm.c @@ -950,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 */ - // tw = m->ww - drawstatusbar(m, bh, stext); - tw = TEXTW(stext); - drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0); + tw = m->ww - drawstatusbar(m, bh, stext); } resizebarwin(m); @@ -2062,8 +2060,8 @@ setup(void) drw = drw_create(dpy, screen, root, sw, sh); if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) die("no fonts could be loaded."); - lrpad = drw->fonts->h + horizpadbar; - bh = drw->fonts->h + vertpadbar; + lrpad = drw->fonts->h; + bh = drw->fonts->h + 2; updategeom(); /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False); diff --git a/config/dwm/dwm.c.orig b/config/dwm/dwm.c.orig index aa3cde64..3b87fabd 100644 --- a/config/dwm/dwm.c.orig +++ b/config/dwm/dwm.c.orig @@ -185,7 +185,6 @@ 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); @@ -274,7 +273,7 @@ static void autostart_exec(void); /* variables */ static Systray *systray = NULL; static const char broken[] = "broken"; -static char stext[1024]; +static char stext[256]; static int screen; static int sw, sh; /* X display screen geometry width, height */ static int bh; /* bar height */ @@ -560,7 +559,7 @@ cleanup(void) for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); - for (i = 0; i < LENGTH(colors) + 1; i++) + for (i = 0; i < LENGTH(colors); i++) free(scheme[i]); free(scheme); XDestroyWindow(dpy, wmcheckwin); @@ -824,115 +823,6 @@ 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) { @@ -950,7 +840,9 @@ drawbar(Monitor *m) /* draw status first so it can be overdrawn by tags later */ if (m == selmon) { /* status is only drawn on selected monitor */ - tw = m->ww - drawstatusbar(m, bh, stext); + 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); } resizebarwin(m); @@ -2090,8 +1982,7 @@ setup(void) cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurMove] = drw_cur_create(drw, XC_fleur); /* init appearance */ - scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *)); - scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3); + scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); /* init system tray */ diff --git a/config/dwm/dwm.c.rej b/config/dwm/dwm.c.rej deleted file mode 100644 index 6762544c..00000000 --- a/config/dwm/dwm.c.rej +++ /dev/null @@ -1,13 +0,0 @@ ---- dwm.c -+++ dwm.c -@@ -708,8 +708,8 @@ 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; /* 2px right padding */ -- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); -+ tw = TEXTW(stext); -+ drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0); - } - - for (c = m->clients; c; c = c->next) {