From da567317ab27ec033fa53c6e4b4823dcfce7d24d Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Mon, 28 Mar 2016 19:38:19 +0200 Subject: Make pango: prefix optional for font config --- sway/commands.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 4d0da26e..333af1b4 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1872,16 +1872,16 @@ static struct cmd_results *cmd_font(int argc, char **argv) { } char *font = join_args(argv, argc); + free(config->font); if (strlen(font) > 6 && strncmp("pango:", font, 6) == 0) { - free(config->font); - config->font = font; - sway_log(L_DEBUG, "Settings font %s", config->font); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); - } else { + config->font = strdup(font + 6); free(font); - return cmd_results_new(CMD_FAILURE, "font", "non-pango font detected"); + } else { + config->font = font; } + sway_log(L_DEBUG, "Settings font %s", config->font); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); } -- cgit v1.2.3