diff options
author | Moelf <jerryling315@gmail.com> | 2019-05-10 23:57:53 -0700 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-05-14 00:11:04 -0400 |
commit | ed2e553b8d0dff3e74eeaa80a2586458271b2565 (patch) | |
tree | 3b48f4efad369798686611f21a380330e4c930dc /sway/desktop/output.c | |
parent | Spawn swaybar as a wayland client (diff) | |
download | sway-ed2e553b8d0dff3e74eeaa80a2586458271b2565.tar.gz sway-ed2e553b8d0dff3e74eeaa80a2586458271b2565.tar.zst sway-ed2e553b8d0dff3e74eeaa80a2586458271b2565.zip |
Implement output toggle
discussed in #4136, this can't handle wildcard but won't crash.
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 13 |
1 files changed, 13 insertions, 0 deletions
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) { | |||
42 | return NULL; | 42 | return NULL; |
43 | } | 43 | } |
44 | 44 | ||
45 | struct sway_output *all_output_by_name_or_id(const char *name_or_id) { | ||
46 | struct sway_output *output; | ||
47 | wl_list_for_each(output, &root->all_outputs, link) { | ||
48 | char identifier[128]; | ||
49 | output_get_identifier(identifier, sizeof(identifier), output); | ||
50 | if (strcasecmp(identifier, name_or_id) == 0 | ||
51 | || strcasecmp(output->wlr_output->name, name_or_id) == 0) { | ||
52 | return output; | ||
53 | } | ||
54 | } | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
45 | /** | 58 | /** |
46 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), | 59 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), |
47 | * the child position is (*sx, *sy) and its size is (sw, sh). | 60 | * the child position is (*sx, *sy) and its size is (sw, sh). |