diff options
author | Brian Ashworth <RedSoxFan@users.noreply.github.com> | 2018-05-14 00:28:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 00:28:21 -0400 |
commit | 34b864fb1752fde2528db6aa86d53c23412a8f43 (patch) | |
tree | b387f1e1eb8f8fc16faeb4bf24a0ab6e8ba5787c /sway/commands/output.c | |
parent | 6ff7c5273659061ec4ff2f6c79c69af2d4d165a5 (diff) | |
parent | 270c1ee7e507f1d2960920a7f4f0cc70f4e13d26 (diff) |
Merge branch 'master' into fix-1975
Diffstat (limited to 'sway/commands/output.c')
-rw-r--r-- | sway/commands/output.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sway/commands/output.c b/sway/commands/output.c index f7e3372c..e8881f77 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -20,6 +20,25 @@ static char *bg_options[] = { "tile", }; +static struct cmd_results *cmd_output_dpms(struct output_config *output, + int *i, int argc, char **argv) { + + if (++*i >= argc) { + return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument."); + } + + char *value = argv[*i]; + if (strcmp(value, "on") == 0) { + output->dpms_state = DPMS_ON; + } else if (strcmp(value, "off") == 0) { + output->dpms_state = DPMS_OFF; + } else { + return cmd_results_new(CMD_INVALID, "output", + "Invalid dpms state, valid states are on/off."); + } + return NULL; +} + static struct cmd_results *cmd_output_mode(struct output_config *output, int *i, int argc, char **argv) { if (++*i >= argc) { @@ -263,6 +282,8 @@ struct cmd_results *cmd_output(int argc, char **argv) { } else if (strcasecmp(command, "background") == 0 || strcasecmp(command, "bg") == 0) { error = cmd_output_background(output, &i, argc, argv); + } else if (strcasecmp(command, "dpms") == 0) { + error = cmd_output_dpms(output, &i, argc, argv); } else { error = cmd_results_new(CMD_INVALID, "output", "Invalid output subcommand: %s.", command); @@ -285,10 +306,10 @@ struct cmd_results *cmd_output(int argc, char **argv) { } wlr_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " - "position %d,%d scale %f transform %d) (bg %s %s)", + "position %d,%d scale %f transform %d) (bg %s %s) (dpms %d)", output->name, output->enabled, output->width, output->height, output->refresh_rate, output->x, output->y, output->scale, - output->transform, output->background, output->background_option); + output->transform, output->background, output->background_option, output->dpms_state); // Try to find the output container and apply configuration now. If // this is during startup then there will be no container and config |