summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c22
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;
51static sway_cmd cmd_floating_mod; 51static sway_cmd cmd_floating_mod;
52static sway_cmd cmd_focus; 52static sway_cmd cmd_focus;
53static sway_cmd cmd_focus_follows_mouse; 53static sway_cmd cmd_focus_follows_mouse;
54static sway_cmd cmd_font;
54static sway_cmd cmd_for_window; 55static sway_cmd cmd_for_window;
55static sway_cmd cmd_fullscreen; 56static sway_cmd cmd_fullscreen;
56static sway_cmd cmd_gaps; 57static 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
1826static 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
1825static struct cmd_results *cmd_for_window(int argc, char **argv) { 1846static 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 },