2018-06-03 11:33:16 +10:00
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/config.h"
|
2018-07-24 05:04:46 +10:00
|
|
|
#include "util.h"
|
2018-06-03 11:33:16 +10:00
|
|
|
|
|
|
|
struct cmd_results *output_cmd_dpms(int argc, char **argv) {
|
|
|
|
if (!config->handler_context.output_config) {
|
|
|
|
return cmd_results_new(CMD_FAILURE, "output", "Missing output config");
|
|
|
|
}
|
|
|
|
if (!argc) {
|
|
|
|
return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument.");
|
|
|
|
}
|
|
|
|
|
2018-07-24 05:04:46 +10:00
|
|
|
if (parse_boolean(argv[0], true)) {
|
2018-06-03 11:33:16 +10:00
|
|
|
config->handler_context.output_config->dpms_state = DPMS_ON;
|
|
|
|
} else {
|
2018-07-24 05:04:46 +10:00
|
|
|
config->handler_context.output_config->dpms_state = DPMS_OFF;
|
2018-06-03 11:33:16 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
config->handler_context.leftovers.argc = argc - 1;
|
|
|
|
config->handler_context.leftovers.argv = argv + 1;
|
|
|
|
return NULL;
|
|
|
|
}
|