aboutsummaryrefslogtreecommitdiff
path: root/swaybar/config.c
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2018-10-19 08:30:05 +0200
committerRouven Czerwinski <rouven@czerwinskis.de>2018-10-20 08:21:44 +0200
commitf52825336ca32c7244ce08313d8a38afe5430aa5 (patch)
treea0dc2c30bc7ee5a9849714a156216cb716b50d64 /swaybar/config.c
parent0a4735c50cbdb7cc60f8cdf1d0240bda37d63033 (diff)
swaybar: disallow left and right position and print error on default
The positions "left" and "right" are not allowed by the man page, remove them from the allowed positions. Also print an error to stderr if we default to the bottom position. Fixes #2878
Diffstat (limited to 'swaybar/config.c')
-rw-r--r--swaybar/config.c8
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 @@
#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <string.h>
+#include <wlr/util/log.h>
#include "swaybar/config.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "stringop.h"
@@ -9,17 +10,12 @@
uint32_t parse_position(const char *position) {
uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
- uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
- ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
if (strcmp("top", position) == 0) {
return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | horiz;
} else if (strcmp("bottom", position) == 0) {
return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
- } else if (strcmp("left", position) == 0) {
- return ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | vert;
- } else if (strcmp("right", position) == 0) {
- return ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | vert;
} else {
+ wlr_log(WLR_ERROR, "Invalid position: %s, defaulting to bottom", position);
return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
}
}