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 */
|
/** The height of the font, built from font_ascent + font_descent */
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
|
/** The pattern/name used to load the font. */
|
||||||
|
char *pattern;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
/** The xcb-id for the font */
|
/** The xcb-id for the font */
|
||||||
|
|
16
libi3/font.c
16
libi3/font.c
|
@ -2,7 +2,7 @@
|
||||||
* vim:ts=4:sw=4:expandtab
|
* vim:ts=4:sw=4:expandtab
|
||||||
*
|
*
|
||||||
* i3 - an improved dynamic tiling window manager
|
* 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>
|
#include <assert.h>
|
||||||
|
@ -143,13 +143,17 @@ i3Font load_font(const char *pattern, const bool fallback) {
|
||||||
#if PANGO_SUPPORT
|
#if PANGO_SUPPORT
|
||||||
/* Try to load a pango font if specified */
|
/* Try to load a pango font if specified */
|
||||||
if (strlen(pattern) > strlen("pango:") && !strncmp(pattern, "pango:", strlen("pango:"))) {
|
if (strlen(pattern) > strlen("pango:") && !strncmp(pattern, "pango:", strlen("pango:"))) {
|
||||||
pattern += strlen("pango:");
|
const char *font_pattern = pattern + strlen("pango:");
|
||||||
if (load_pango_font(&font, pattern))
|
if (load_pango_font(&font, font_pattern)) {
|
||||||
|
font.pattern = sstrdup(pattern);
|
||||||
return font;
|
return font;
|
||||||
|
}
|
||||||
} else if (strlen(pattern) > strlen("xft:") && !strncmp(pattern, "xft:", strlen("xft:"))) {
|
} else if (strlen(pattern) > strlen("xft:") && !strncmp(pattern, "xft:", strlen("xft:"))) {
|
||||||
pattern += strlen("xft:");
|
const char *font_pattern = pattern + strlen("xft:");
|
||||||
if (load_pango_font(&font, pattern))
|
if (load_pango_font(&font, font_pattern)) {
|
||||||
|
font.pattern = sstrdup(pattern);
|
||||||
return font;
|
return font;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -189,6 +193,7 @@ i3Font load_font(const char *pattern, const bool fallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
font.pattern = sstrdup(pattern);
|
||||||
LOG("Using X font %s\n", pattern);
|
LOG("Using X font %s\n", pattern);
|
||||||
|
|
||||||
/* Get information (height/name) for this font */
|
/* Get information (height/name) for this font */
|
||||||
|
@ -222,6 +227,7 @@ void set_font(i3Font *font) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void free_font(void) {
|
void free_font(void) {
|
||||||
|
free(savedFont->pattern);
|
||||||
switch (savedFont->type) {
|
switch (savedFont->type) {
|
||||||
case FONT_TYPE_NONE:
|
case FONT_TYPE_NONE:
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* vim:ts=4:sw=4:expandtab
|
* vim:ts=4:sw=4:expandtab
|
||||||
*
|
*
|
||||||
* i3 - an improved dynamic tiling window manager
|
* 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.
|
* 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);
|
sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename);
|
||||||
char *argv[] = {
|
char *argv[] = {
|
||||||
NULL, /* will be replaced by the executable path */
|
NULL, /* will be replaced by the executable path */
|
||||||
|
"-f",
|
||||||
|
config.font.pattern,
|
||||||
"-t",
|
"-t",
|
||||||
(context->has_errors ? "error" : "warning"),
|
(context->has_errors ? "error" : "warning"),
|
||||||
"-m",
|
"-m",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* vim:ts=4:sw=4:expandtab
|
* vim:ts=4:sw=4:expandtab
|
||||||
*
|
*
|
||||||
* i3 - an improved dynamic tiling window manager
|
* 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
|
* 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);
|
sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename);
|
||||||
char *argv[] = {
|
char *argv[] = {
|
||||||
NULL, /* will be replaced by the executable path */
|
NULL, /* will be replaced by the executable path */
|
||||||
|
"-f",
|
||||||
|
config.font.pattern,
|
||||||
"-t",
|
"-t",
|
||||||
"error",
|
"error",
|
||||||
"-m",
|
"-m",
|
||||||
|
|
Loading…
Reference in New Issue