From ed2e553b8d0dff3e74eeaa80a2586458271b2565 Mon Sep 17 00:00:00 2001
From: Moelf <jerryling315@gmail.com>
Date: Fri, 10 May 2019 23:57:53 -0700
Subject: Implement output toggle

discussed in #4136, this can't handle wildcard but won't crash.
---
 sway/desktop/output.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'sway/desktop')

diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 0cc08525..1636a58b 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -42,6 +42,19 @@ struct sway_output *output_by_name_or_id(const char *name_or_id) {
 	return NULL;
 }
 
+struct sway_output *all_output_by_name_or_id(const char *name_or_id) {
+	struct sway_output *output;
+	wl_list_for_each(output, &root->all_outputs, link) {
+		char identifier[128];
+		output_get_identifier(identifier, sizeof(identifier), output);
+		if (strcasecmp(identifier, name_or_id) == 0
+				|| strcasecmp(output->wlr_output->name, name_or_id) == 0) {
+			return output;
+		}
+	}
+	return NULL;
+}
+
 /**
  * Rotate a child's position relative to a parent. The parent size is (pw, ph),
  * the child position is (*sx, *sy) and its size is (sw, sh).
-- 
cgit v1.2.3