aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 0102fc5a..c81379fd 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -30,6 +30,7 @@ struct cmd_handler {
30 30
31static sway_cmd cmd_bindsym; 31static sway_cmd cmd_bindsym;
32static sway_cmd cmd_orientation; 32static sway_cmd cmd_orientation;
33static sway_cmd cmd_debuglog;
33static sway_cmd cmd_exec; 34static sway_cmd cmd_exec;
34static sway_cmd cmd_exec_always; 35static sway_cmd cmd_exec_always;
35static sway_cmd cmd_exit; 36static sway_cmd cmd_exit;
@@ -229,6 +230,28 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
229 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 230 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
230} 231}
231 232
233static struct cmd_results *cmd_debuglog(int argc, char **argv) {
234 struct cmd_results *error = NULL;
235 if ((error = checkarg(argc, "debuglog", EXPECTED_EQUAL_TO, 1))) {
236 return error;
237 } else if (strcasecmp(argv[0], "toggle") == 0) {
238 if (config->reading) {
239 return cmd_results_new(CMD_FAILURE, "debuglog toggle", "Can't be used in config file.");
240 }
241 if (toggle_debug_logging()) {
242 sway_log(L_DEBUG, "Debuglog turned on.");
243 }
244 } else if (strcasecmp(argv[0], "on") == 0) {
245 set_log_level(L_DEBUG);
246 sway_log(L_DEBUG, "Debuglog turned on.");
247 } else if (strcasecmp(argv[0], "off") == 0) {
248 reset_log_level();
249 } else {
250 return cmd_results_new(CMD_FAILURE, "debuglog", "Expected 'debuglog on|off|toggle'");
251 }
252 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
253}
254
232static struct cmd_results *cmd_exec(int argc, char **argv) { 255static struct cmd_results *cmd_exec(int argc, char **argv) {
233 if (!config->active) return cmd_results_new(CMD_DEFER, "exec", NULL); 256 if (!config->active) return cmd_results_new(CMD_DEFER, "exec", NULL);
234 if (config->reloading) { 257 if (config->reloading) {
@@ -1162,6 +1185,7 @@ static struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
1162/* Keep alphabetized */ 1185/* Keep alphabetized */
1163static struct cmd_handler handlers[] = { 1186static struct cmd_handler handlers[] = {
1164 { "bindsym", cmd_bindsym }, 1187 { "bindsym", cmd_bindsym },
1188 { "debuglog", cmd_debuglog },
1165 { "default_orientation", cmd_orientation }, 1189 { "default_orientation", cmd_orientation },
1166 { "exec", cmd_exec }, 1190 { "exec", cmd_exec },
1167 { "exec_always", cmd_exec_always }, 1191 { "exec_always", cmd_exec_always },