aboutsummaryrefslogtreecommitdiff
path: root/swaybar/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/main.c')
-rw-r--r--swaybar/main.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/swaybar/main.c b/swaybar/main.c
index 0abd0755..c897e1c9 100644
--- a/swaybar/main.c
+++ b/swaybar/main.c
@@ -4,21 +4,20 @@
#include <string.h>
#include <stdbool.h>
#include <getopt.h>
+#include <wlr/util/log.h>
#include "swaybar/bar.h"
#include "ipc-client.h"
-#include "log.h"
-/* global bar state */
-struct bar swaybar;
+static struct swaybar swaybar;
-void sway_terminate(int exit_code) {
+void sig_handler(int signal) {
bar_teardown(&swaybar);
- exit(exit_code);
+ exit(0);
}
-void sig_handler(int signal) {
+void sway_terminate(int code) {
bar_teardown(&swaybar);
- exit(0);
+ exit(code);
}
int main(int argc, char **argv) {
@@ -75,20 +74,23 @@ int main(int argc, char **argv) {
}
}
- if (!bar_id) {
- sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar");
- }
-
if (debug) {
- init_log(L_DEBUG);
+ wlr_log_init(L_DEBUG, NULL);
} else {
- init_log(L_ERROR);
+ wlr_log_init(L_ERROR, NULL);
+ }
+
+ if (!bar_id) {
+ wlr_log(L_ERROR, "No bar_id passed. "
+ "Provide --bar_id or let sway start swaybar");
+ return 1;
}
if (!socket_path) {
socket_path = get_socketpath();
if (!socket_path) {
- sway_abort("Unable to retrieve socket path");
+ wlr_log(L_ERROR, "Unable to retrieve socket path");
+ return 1;
}
}
@@ -100,9 +102,6 @@ int main(int argc, char **argv) {
free(bar_id);
bar_run(&swaybar);
-
- // gracefully shutdown swaybar and status_command
bar_teardown(&swaybar);
-
return 0;
}