diff options
author | crondog <crondog@gmail.com> | 2016-01-27 16:57:55 +1100 |
---|---|---|
committer | crondog <crondog@gmail.com> | 2016-01-27 20:53:31 +1100 |
commit | 0ee55474067364159f84806b7b0813492ed4e546 (patch) | |
tree | d1f5bd624cf3dccc1987ccfc1fe20130a2d4cf4a /sway/commands.c | |
parent | Remove pointer from swaylock surface (diff) | |
download | sway-0ee55474067364159f84806b7b0813492ed4e546.tar.gz sway-0ee55474067364159f84806b7b0813492ed4e546.tar.zst sway-0ee55474067364159f84806b7b0813492ed4e546.zip |
font: Allow adding font to the config. In prep for border titles
v2: Give default font and make bar use it if no bar font
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index ae5c48e6..8fec1223 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -51,6 +51,7 @@ static sway_cmd cmd_floating; | |||
51 | static sway_cmd cmd_floating_mod; | 51 | static sway_cmd cmd_floating_mod; |
52 | static sway_cmd cmd_focus; | 52 | static sway_cmd cmd_focus; |
53 | static sway_cmd cmd_focus_follows_mouse; | 53 | static sway_cmd cmd_focus_follows_mouse; |
54 | static sway_cmd cmd_font; | ||
54 | static sway_cmd cmd_for_window; | 55 | static sway_cmd cmd_for_window; |
55 | static sway_cmd cmd_fullscreen; | 56 | static sway_cmd cmd_fullscreen; |
56 | static sway_cmd cmd_gaps; | 57 | static sway_cmd cmd_gaps; |
@@ -1822,6 +1823,26 @@ static struct cmd_results *cmd_log_colors(int argc, char **argv) { | |||
1822 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 1823 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
1823 | } | 1824 | } |
1824 | 1825 | ||
1826 | static struct cmd_results *cmd_font(int argc, char **argv) { | ||
1827 | struct cmd_results *error = NULL; | ||
1828 | if ((error = checkarg(argc, "font", EXPECTED_AT_LEAST, 1))) { | ||
1829 | return error; | ||
1830 | } | ||
1831 | |||
1832 | char *font = join_args(argv, argc); | ||
1833 | if (strlen(font) > 6 && strncmp("pango:", font, 6) == 0) { | ||
1834 | free(config->font); | ||
1835 | config->font = font; | ||
1836 | sway_log(L_DEBUG, "Settings font %s", config->font); | ||
1837 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
1838 | } else { | ||
1839 | free(font); | ||
1840 | return cmd_results_new(CMD_FAILURE, "font", "non-pango font detected"); | ||
1841 | } | ||
1842 | |||
1843 | } | ||
1844 | |||
1845 | |||
1825 | static struct cmd_results *cmd_for_window(int argc, char **argv) { | 1846 | static struct cmd_results *cmd_for_window(int argc, char **argv) { |
1826 | struct cmd_results *error = NULL; | 1847 | struct cmd_results *error = NULL; |
1827 | if ((error = checkarg(argc, "for_window", EXPECTED_AT_LEAST, 2))) { | 1848 | if ((error = checkarg(argc, "for_window", EXPECTED_AT_LEAST, 2))) { |
@@ -1978,6 +1999,7 @@ static struct cmd_handler handlers[] = { | |||
1978 | { "floating_modifier", cmd_floating_mod }, | 1999 | { "floating_modifier", cmd_floating_mod }, |
1979 | { "focus", cmd_focus }, | 2000 | { "focus", cmd_focus }, |
1980 | { "focus_follows_mouse", cmd_focus_follows_mouse }, | 2001 | { "focus_follows_mouse", cmd_focus_follows_mouse }, |
2002 | { "font", cmd_font }, | ||
1981 | { "for_window", cmd_for_window }, | 2003 | { "for_window", cmd_for_window }, |
1982 | { "fullscreen", cmd_fullscreen }, | 2004 | { "fullscreen", cmd_fullscreen }, |
1983 | { "gaps", cmd_gaps }, | 2005 | { "gaps", cmd_gaps }, |