aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/output
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-07-23 15:04:46 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-07-23 21:33:17 -0400
commit863914ec9574eb58cb0746d59f216997c4863cdf (patch)
treeaaddd8ae854d1dde4b50cfd4ef470c1acf83b6ce /sway/commands/output
parentMerge pull request #2342 from RyanDwyer/update-cursor (diff)
downloadsway-863914ec9574eb58cb0746d59f216997c4863cdf.tar.gz
sway-863914ec9574eb58cb0746d59f216997c4863cdf.tar.zst
sway-863914ec9574eb58cb0746d59f216997c4863cdf.zip
Switch to using a function to parse booleans
Diffstat (limited to 'sway/commands/output')
-rw-r--r--sway/commands/output/dpms.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sway/commands/output/dpms.c b/sway/commands/output/dpms.c
index 0959ea6b..3492061e 100644
--- a/sway/commands/output/dpms.c
+++ b/sway/commands/output/dpms.c
@@ -1,5 +1,6 @@
1#include "sway/commands.h" 1#include "sway/commands.h"
2#include "sway/config.h" 2#include "sway/config.h"
3#include "util.h"
3 4
4struct cmd_results *output_cmd_dpms(int argc, char **argv) { 5struct cmd_results *output_cmd_dpms(int argc, char **argv) {
5 if (!config->handler_context.output_config) { 6 if (!config->handler_context.output_config) {
@@ -9,13 +10,10 @@ struct cmd_results *output_cmd_dpms(int argc, char **argv) {
9 return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument."); 10 return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument.");
10 } 11 }
11 12
12 if (strcmp(*argv, "on") == 0) { 13 if (parse_boolean(argv[0], true)) {
13 config->handler_context.output_config->dpms_state = DPMS_ON; 14 config->handler_context.output_config->dpms_state = DPMS_ON;
14 } else if (strcmp(*argv, "off") == 0) {
15 config->handler_context.output_config->dpms_state = DPMS_OFF;
16 } else { 15 } else {
17 return cmd_results_new(CMD_INVALID, "output", 16 config->handler_context.output_config->dpms_state = DPMS_OFF;
18 "Invalid dpms state, valid states are on/off.");
19 } 17 }
20 18
21 config->handler_context.leftovers.argc = argc - 1; 19 config->handler_context.leftovers.argc = argc - 1;