Make i3-nagbar use the same font as configured for i3
This commit is contained in:
parent
76ef3a4ab8
commit
62b0df0640
|
@ -47,6 +47,9 @@ struct Font {
|
|||
/** The height of the font, built from font_ascent + font_descent */
|
||||
int height;
|
||||
|
||||
/** The pattern/name used to load the font. */
|
||||
char *pattern;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/** The xcb-id for the font */
|
||||
|
|
16
libi3/font.c
16
libi3/font.c
|
@ -2,7 +2,7 @@
|
|||
* vim:ts=4:sw=4:expandtab
|
||||
*
|
||||
* i3 - an improved dynamic tiling window manager
|
||||
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
*
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
@ -143,14 +143,18 @@ i3Font load_font(const char *pattern, const bool fallback) {
|
|||
#if PANGO_SUPPORT
|
||||
/* Try to load a pango font if specified */
|
||||
if (strlen(pattern) > strlen("pango:") && !strncmp(pattern, "pango:", strlen("pango:"))) {
|
||||
pattern += strlen("pango:");
|
||||
if (load_pango_font(&font, pattern))
|
||||
const char *font_pattern = pattern + strlen("pango:");
|
||||
if (load_pango_font(&font, font_pattern)) {
|
||||
font.pattern = sstrdup(pattern);
|
||||
return font;
|
||||
}
|
||||
} else if (strlen(pattern) > strlen("xft:") && !strncmp(pattern, "xft:", strlen("xft:"))) {
|
||||
pattern += strlen("xft:");
|
||||
if (load_pango_font(&font, pattern))
|
||||
const char *font_pattern = pattern + strlen("xft:");
|
||||
if (load_pango_font(&font, font_pattern)) {
|
||||
font.pattern = sstrdup(pattern);
|
||||
return font;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Send all our requests first */
|
||||
|
@ -189,6 +193,7 @@ i3Font load_font(const char *pattern, const bool fallback) {
|
|||
}
|
||||
}
|
||||
|
||||
font.pattern = sstrdup(pattern);
|
||||
LOG("Using X font %s\n", pattern);
|
||||
|
||||
/* Get information (height/name) for this font */
|
||||
|
@ -222,6 +227,7 @@ void set_font(i3Font *font) {
|
|||
*
|
||||
*/
|
||||
void free_font(void) {
|
||||
free(savedFont->pattern);
|
||||
switch (savedFont->type) {
|
||||
case FONT_TYPE_NONE:
|
||||
/* Nothing to do */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* vim:ts=4:sw=4:expandtab
|
||||
*
|
||||
* i3 - an improved dynamic tiling window manager
|
||||
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
*
|
||||
* config_parser.c: hand-written parser to parse configuration directives.
|
||||
*
|
||||
|
@ -1059,6 +1059,8 @@ void parse_file(const char *f) {
|
|||
sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename);
|
||||
char *argv[] = {
|
||||
NULL, /* will be replaced by the executable path */
|
||||
"-f",
|
||||
config.font.pattern,
|
||||
"-t",
|
||||
(context->has_errors ? "error" : "warning"),
|
||||
"-m",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* vim:ts=4:sw=4:expandtab
|
||||
*
|
||||
* i3 - an improved dynamic tiling window manager
|
||||
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
|
||||
*
|
||||
* key_press.c: key press handler
|
||||
*
|
||||
|
@ -145,6 +145,8 @@ void handle_key_press(xcb_key_press_event_t *event) {
|
|||
sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename);
|
||||
char *argv[] = {
|
||||
NULL, /* will be replaced by the executable path */
|
||||
"-f",
|
||||
config.font.pattern,
|
||||
"-t",
|
||||
"error",
|
||||
"-m",
|
||||
|
|
Loading…
Reference in New Issue