aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/output
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-07-23 15:04:46 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-07-23 21:33:17 -0400
commit863914ec9574eb58cb0746d59f216997c4863cdf (patch)
treeaaddd8ae854d1dde4b50cfd4ef470c1acf83b6ce /sway/commands/output
parent224ade138208e9aa525423cbfbd643aa9d9b63c3 (diff)
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 @@
#include "sway/commands.h"
#include "sway/config.h"
+#include "util.h"
struct cmd_results *output_cmd_dpms(int argc, char **argv) {
if (!config->handler_context.output_config) {
@@ -9,13 +10,10 @@ struct cmd_results *output_cmd_dpms(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument.");
}
- if (strcmp(*argv, "on") == 0) {
+ if (parse_boolean(argv[0], true)) {
config->handler_context.output_config->dpms_state = DPMS_ON;
- } else if (strcmp(*argv, "off") == 0) {
- config->handler_context.output_config->dpms_state = DPMS_OFF;
} else {
- return cmd_results_new(CMD_INVALID, "output",
- "Invalid dpms state, valid states are on/off.");
+ config->handler_context.output_config->dpms_state = DPMS_OFF;
}
config->handler_context.leftovers.argc = argc - 1;