mirror of
https://github.com/swaywm/sway.git
synced 2025-11-09 13:29:49 -05:00
Add minimal config subsystem
This commit is contained in:
parent
83b4c0648d
commit
90f7f1a0e6
11 changed files with 1091 additions and 19 deletions
|
|
@ -1,16 +1,16 @@
|
|||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
|
||||
struct cmd_results *cmd_exec(int argc, char **argv) {
|
||||
// TODO: config
|
||||
/*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) {
|
||||
char *args = join_args(argv, argc);
|
||||
sway_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
|
||||
free(args);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}*/
|
||||
}
|
||||
return cmd_exec_always(argc, argv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/workspace.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/container.h"
|
||||
#include "sway/workspace.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
|
||||
struct cmd_results *cmd_exec_always(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
// TODO: config
|
||||
//if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
|
||||
if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
|
||||
if ((error = checkarg(argc, "exec_always", EXPECTED_MORE_THAN, 0))) {
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
#include <stddef.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
|
||||
void sway_terminate(int exit_code);
|
||||
|
||||
struct cmd_results *cmd_exit(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
/* TODO
|
||||
if (config->reading) {
|
||||
return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file.");
|
||||
}
|
||||
*/
|
||||
if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) {
|
||||
return error;
|
||||
}
|
||||
sway_terminate(0);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue