diff options
author | 2018-10-20 08:35:20 +0200 | |
---|---|---|
committer | 2018-10-20 08:35:20 +0200 | |
commit | 4bde0eb911062817b9b41e91039b373b1efb0e0e (patch) | |
tree | a2664a38b2fa5da960f432debf65ce60c0d60eb6 /swaybar/config.c | |
parent | Merge pull request #2872 from RyanDwyer/cursor-rebase (diff) | |
parent | commands/bar: remove left and right from allowed positions (diff) | |
download | sway-4bde0eb911062817b9b41e91039b373b1efb0e0e.tar.gz sway-4bde0eb911062817b9b41e91039b373b1efb0e0e.tar.zst sway-4bde0eb911062817b9b41e91039b373b1efb0e0e.zip |
Merge pull request #2879 from Emantor/fix/swaybar_position
swaybar: disallow left and right position and print error on default
Diffstat (limited to 'swaybar/config.c')
-rw-r--r-- | swaybar/config.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/swaybar/config.c b/swaybar/config.c index eafb0b69..1293cdae 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _XOPEN_SOURCE 500 |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <wlr/util/log.h> | ||
4 | #include "swaybar/config.h" | 5 | #include "swaybar/config.h" |
5 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 6 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
6 | #include "stringop.h" | 7 | #include "stringop.h" |
@@ -9,17 +10,12 @@ | |||
9 | uint32_t parse_position(const char *position) { | 10 | uint32_t parse_position(const char *position) { |
10 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | | 11 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | |
11 | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; | 12 | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; |
12 | uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | | ||
13 | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; | ||
14 | if (strcmp("top", position) == 0) { | 13 | if (strcmp("top", position) == 0) { |
15 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | horiz; | 14 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | horiz; |
16 | } else if (strcmp("bottom", position) == 0) { | 15 | } else if (strcmp("bottom", position) == 0) { |
17 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; | 16 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; |
18 | } else if (strcmp("left", position) == 0) { | ||
19 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | vert; | ||
20 | } else if (strcmp("right", position) == 0) { | ||
21 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | vert; | ||
22 | } else { | 17 | } else { |
18 | wlr_log(WLR_ERROR, "Invalid position: %s, defaulting to bottom", position); | ||
23 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; | 19 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; |
24 | } | 20 | } |
25 | } | 21 | } |