diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-20 13:30:11 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-20 13:30:11 -0500 |
commit | adf5b8fed70b3b61e67f16c3bec4a9b25d8ec831 (patch) | |
tree | 9432025d23987c4316db3c2cd1abb8c328df4cae /swaybar/main.c | |
parent | 3082245243689e978186d6a6ba69972b050fb288 (diff) | |
parent | 83eb8d16aaeeaeca374413ecf9db93c531f4e9fc (diff) |
Merge pull request #380 from mikkeloscar/bar-font-support
swaybar: Add font support
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 5b8ba45d..88cd1dbe 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -186,6 +186,15 @@ uint32_t parse_position(const char *position) { } } +char *parse_font(const char *font) { + char *new_font = NULL; + if (strncmp("pango:", font, 6) == 0) { + new_font = strdup(font + 6); + } + + return new_font; +} + static int margin = 3; static const int ws_hor_padding = 5; static double ws_ver_padding = 1.5; @@ -232,6 +241,10 @@ void bar_ipc_init(int outputi, const char *bar_id) { desktop_shell_set_panel_position(registry->desktop_shell, parse_position(json_object_get_string(position))); } + if (font) { + window->font = parse_font(json_object_get_string(font)); + } + if (bar_height) { int width, height; get_text_size(window, &width, &height, "Test string for measuring purposes"); |