@ -30,6 +30,7 @@ struct cmd_handler {
static sway_cmd cmd_bindsym ;
static sway_cmd cmd_bindsym ;
static sway_cmd cmd_orientation ;
static sway_cmd cmd_orientation ;
static sway_cmd cmd_debuglog ;
static sway_cmd cmd_exec ;
static sway_cmd cmd_exec ;
static sway_cmd cmd_exec_always ;
static sway_cmd cmd_exec_always ;
static sway_cmd cmd_exit ;
static sway_cmd cmd_exit ;
@ -229,6 +230,28 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
return cmd_results_new ( CMD_SUCCESS , NULL , NULL ) ;
return cmd_results_new ( CMD_SUCCESS , NULL , NULL ) ;
}
}
static struct cmd_results * cmd_debuglog ( int argc , char * * argv ) {
struct cmd_results * error = NULL ;
if ( ( error = checkarg ( argc , " debuglog " , EXPECTED_EQUAL_TO , 1 ) ) ) {
return error ;
} else if ( strcasecmp ( argv [ 0 ] , " toggle " ) = = 0 ) {
if ( config - > reading ) {
return cmd_results_new ( CMD_FAILURE , " debuglog toggle " , " Can't be used in config file. " ) ;
}
if ( toggle_debug_logging ( ) ) {
sway_log ( L_DEBUG , " Debuglog turned on. " ) ;
}
} else if ( strcasecmp ( argv [ 0 ] , " on " ) = = 0 ) {
set_log_level ( L_DEBUG ) ;
sway_log ( L_DEBUG , " Debuglog turned on. " ) ;
} else if ( strcasecmp ( argv [ 0 ] , " off " ) = = 0 ) {
reset_log_level ( ) ;
} else {
return cmd_results_new ( CMD_FAILURE , " debuglog " , " Expected 'debuglog on|off|toggle' " ) ;
}
return cmd_results_new ( CMD_SUCCESS , NULL , NULL ) ;
}
static struct cmd_results * cmd_exec ( int argc , char * * argv ) {
static struct cmd_results * cmd_exec ( int argc , char * * argv ) {
if ( ! config - > active ) return cmd_results_new ( CMD_DEFER , " exec " , NULL ) ;
if ( ! config - > active ) return cmd_results_new ( CMD_DEFER , " exec " , NULL ) ;
if ( config - > reloading ) {
if ( config - > reloading ) {
@ -1162,6 +1185,7 @@ static struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
/* Keep alphabetized */
/* Keep alphabetized */
static struct cmd_handler handlers [ ] = {
static struct cmd_handler handlers [ ] = {
{ " bindsym " , cmd_bindsym } ,
{ " bindsym " , cmd_bindsym } ,
{ " debuglog " , cmd_debuglog } ,
{ " default_orientation " , cmd_orientation } ,
{ " default_orientation " , cmd_orientation } ,
{ " exec " , cmd_exec } ,
{ " exec " , cmd_exec } ,
{ " exec_always " , cmd_exec_always } ,
{ " exec_always " , cmd_exec_always } ,