further hack on the title, change fonts -> fontarray so we can use fonts

for the misc fonts
This commit is contained in:
speediegq 2022-10-18 22:19:51 +02:00
parent 0392ef2431
commit 10b6c09eb6
4 changed files with 67 additions and 28 deletions

View file

@ -11,8 +11,9 @@
!! If you want more than three fonts, add a comma to font3 and add another to it.
!!
- speedwm.font: NotoSans-Regular:size=8:antialiasing=true
- speedwm.font2: fontawesome:size=8
- speedwm.font3: Noto Color Emoji:size=8
- speedwm.font2: fontawesome:size=8:antialiasing=true
- speedwm.font3: Noto Color Emoji:size=8:antialiasing=true
- speedwm.fonts: Noto Emoji:size=8:antialiasing=true, monospace:size=8:antialiasing=true
!!
!! -/ Bar colors \-
!!

View file

@ -132,15 +132,22 @@ static int floatscratchpad = 0; /* Float the scratchpad windo
static int focusspawn = 0; /* Automatically focus the next spawned window. If warp is enabled, this is useless and will be disabled. (1/0) */
static int autoresize = 1; /* Allow resizing clients automatically when they request it. */
/* Font options */
static char font[] = { "NotoSans-Regular:size=8:antialiasing=true" }; /* What font should we use? */
/* Font options
*
* Main fonts
*/
static char font[] = { "NotoSans-Regular:size=8:antialiasing=true" }; /* First font */
static char font2[] = { "fontawesome:size=8:antialiasing=true" }; /* Second font */
static char font3[] = { "Noto Color Emoji:size=8:antialiasing=true" }; /* Third font */
static char *fonts[] = { font, font2, font3 }; /* All fonts */
static char defaultstatus[] = ""; /* What to print when a status bar is not running */
/* Bar options */
/* Extra fonts */
static char *fonts[] = { "Noto Emoji:size=8:antialiasing=true",
"monospace:size=8:antialiasing=true",
};
/* Status options */
static char status[] = "status"; /* Status bar to use, stellar for stellar, dwmblocks for dwmblocks, slstatus for slstatus, etc. */
static char defaultstatus[] = ""; /* What to print when a status bar is not running */
/* Alternate bar
*

View file

@ -750,6 +750,8 @@ static const char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL };
#include "actions.h" /* include #defines */
#include "options.h" /* Include options */
/* Options */
static char *fontarray[] = { font, font2, font3, fonts }; /* All fonts */
#if USESYSTRAY
static int systraypinningfailfirst = 1;
#endif
@ -2349,15 +2351,29 @@ resizebarwin(m);
if ((w = m->ww - tw - x) > bh) {
#endif
if (n > 0 && !hidetitle) {
int remainder = w % n; /* remainder of the title area */
int tabw = (1.0 / (double)n) * w + 1; /* width of each tab (client in the title area) */
int docontinue = 0; /* whether or not we should (have) continue(ed) or not */
int remainder;
int tabw;
int docontinue;
/* we're doing this to make sure the title does not get truncated when there's only supposed to be one title anyway */
if (!hideunselectedtitle) {
remainder = w % n; /* remainder of the title area */
tabw = (1.0 / (double)n) * w + 1; /* width of each tab (client in the title area) */
} else {
remainder = w;
tabw = w;
}
docontinue = 0; /* whether or not we should (have) continue(ed) or not */
for (c = m->clients; c; c = c->next) {
/* if it's not a window, stop */
/* if it's not a window, continue */
if (!ISVISIBLE(c))
continue;
/* hide unselected title */
else if (m->sel != c && hideunselectedtitle) {
if (m->sel != c && hideunselectedtitle) {
docontinue = 1; /* we're going to continue */
continue;
}
@ -2365,28 +2381,40 @@ resizebarwin(m);
/* selected clients */
if (m->sel == c && colorselectedtitle)
scm = SchemeTitleSel;
/* hidden clients */
else if (HIDDEN(c) && colorhiddentitle)
scm = SchemeTitleHidden;
/* unselected clients */
else if (colortitle)
scm = SchemeTitleNorm;
/* hidden clients */
if (HIDDEN(c) && colorhiddentitle)
if (!hideunselectedtitle)
scm = SchemeTitleHidden;
/* unselected clients */
if (colortitle)
if (!colorselectedtitle)
scm = SchemeTitleNorm;
/* set the scheme */
drw_setscheme(drw, scheme[scm]);
if (remainder >= 0) {
if (remainder == 0) {
tabw--;
}
remainder--;
/* we don't need this if we're only printing focused */
if (!hideunselectedtitle) {
if (remainder >= 0) {
if (remainder == 0) {
tabw--;
}
remainder--;
}
}
/* set scheme if we didn't set it earlier (because we ended the for) */
if (docontinue) {
remainder--;
tabw = 1 * w;
if (colorselectedtitle)
drw_setscheme(drw, scheme[SchemeTitleSel]);
tabw = w;
remainder = w;
/* color selected */
if (colorselectedtitle) {
drw_setscheme(drw, scheme[SchemeTitleSel]);
}
}
/* draw title and icon */
@ -5025,7 +5053,7 @@ setup(void)
root = RootWindow(dpy, screen);
xinitvisual();
drw = drw_create(dpy, screen, root, tw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
if (!drw_fontset_create(drw, fontarray, LENGTH(fontarray)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
bh = altbar ? 0 : drw->fonts->h + barheight;

View file

@ -10,6 +10,7 @@ ResourcePref resources[] = {
{ "font", STRING, &font },
{ "font2", STRING, &font2 },
{ "font3", STRING, &font3 },
{ "fonts", STRING, &fonts },
{ "col_background", STRING, &col_background },
{ "col_titlenorm", STRING, &col_titlenorm },
{ "col_titlesel", STRING, &col_titlesel },
@ -205,8 +206,10 @@ ResourcePref resources[] = {
{ "tagpreviewpaddingh", INTEGER, &tagpreviewpaddingh },
{ "barpreview", INTEGER, &barpreview },
{ "barposition", INTEGER, &barposition },
#if MOUSE
{ "mousepreview", INTEGER, &mousepreview },
#endif
#endif
#if USEFADE
{ "fadeinactive", INTEGER, &fadeinactive },
{ "fadewindows", INTEGER, &fadewindows },