aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 246f4438..96ceea86 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -29,23 +29,13 @@
29#include "sway/tree/view.h" 29#include "sway/tree/view.h"
30#include "sway/tree/workspace.h" 30#include "sway/tree/workspace.h"
31 31
32struct sway_output *output_by_name(const char *name) { 32struct sway_output *output_by_name_or_id(const char *name_or_id) {
33 for (int i = 0; i < root->outputs->length; ++i) { 33 for (int i = 0; i < root->outputs->length; ++i) {
34 struct sway_output *output = root->outputs->items[i]; 34 struct sway_output *output = root->outputs->items[i];
35 if (strcasecmp(output->wlr_output->name, name) == 0) { 35 char identifier[128];
36 return output; 36 output_get_identifier(identifier, sizeof(identifier), output);
37 } 37 if (strcasecmp(identifier, name_or_id) == 0
38 } 38 || strcasecmp(output->wlr_output->name, name_or_id) == 0) {
39 return NULL;
40}
41
42struct sway_output *output_by_identifier(const char *identifier) {
43 for (int i = 0; i < root->outputs->length; ++i) {
44 struct sway_output *output = root->outputs->items[i];
45 char output_identifier[128];
46 snprintf(output_identifier, sizeof(output_identifier), "%s %s %s", output->wlr_output->make,
47 output->wlr_output->model, output->wlr_output->serial);
48 if (strcasecmp(output_identifier, identifier) == 0) {
49 return output; 39 return output;
50 } 40 }
51 } 41 }