diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
commit | cd1b32453a9296c18b28bff71607aeb22987b5cd (patch) | |
tree | c653c6d525b471914c01a9d7ae543f521b6138ed /swaybar/main.c | |
parent | Merge pull request #1634 from aleksander/master (diff) | |
parent | Fix separator height calculation (diff) | |
download | sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.gz sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.zst sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.zip |
Merge branch 'wlroots'
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 33 |
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 @@ | |||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include <getopt.h> | 6 | #include <getopt.h> |
7 | #include <wlr/util/log.h> | ||
7 | #include "swaybar/bar.h" | 8 | #include "swaybar/bar.h" |
8 | #include "ipc-client.h" | 9 | #include "ipc-client.h" |
9 | #include "log.h" | ||
10 | 10 | ||
11 | /* global bar state */ | 11 | static struct swaybar swaybar; |
12 | struct bar swaybar; | ||
13 | 12 | ||
14 | void sway_terminate(int exit_code) { | 13 | void sig_handler(int signal) { |
15 | bar_teardown(&swaybar); | 14 | bar_teardown(&swaybar); |
16 | exit(exit_code); | 15 | exit(0); |
17 | } | 16 | } |
18 | 17 | ||
19 | void sig_handler(int signal) { | 18 | void sway_terminate(int code) { |
20 | bar_teardown(&swaybar); | 19 | bar_teardown(&swaybar); |
21 | exit(0); | 20 | exit(code); |
22 | } | 21 | } |
23 | 22 | ||
24 | int main(int argc, char **argv) { | 23 | int main(int argc, char **argv) { |
@@ -75,20 +74,23 @@ int main(int argc, char **argv) { | |||
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 | ||
78 | if (!bar_id) { | ||
79 | sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar"); | ||
80 | } | ||
81 | |||
82 | if (debug) { | 77 | if (debug) { |
83 | init_log(L_DEBUG); | 78 | wlr_log_init(L_DEBUG, NULL); |
84 | } else { | 79 | } else { |
85 | init_log(L_ERROR); | 80 | wlr_log_init(L_ERROR, NULL); |
81 | } | ||
82 | |||
83 | if (!bar_id) { | ||
84 | wlr_log(L_ERROR, "No bar_id passed. " | ||
85 | "Provide --bar_id or let sway start swaybar"); | ||
86 | return 1; | ||
86 | } | 87 | } |
87 | 88 | ||
88 | if (!socket_path) { | 89 | if (!socket_path) { |
89 | socket_path = get_socketpath(); | 90 | socket_path = get_socketpath(); |
90 | if (!socket_path) { | 91 | if (!socket_path) { |
91 | sway_abort("Unable to retrieve socket path"); | 92 | wlr_log(L_ERROR, "Unable to retrieve socket path"); |
93 | return 1; | ||
92 | } | 94 | } |
93 | } | 95 | } |
94 | 96 | ||
@@ -100,9 +102,6 @@ int main(int argc, char **argv) { | |||
100 | free(bar_id); | 102 | free(bar_id); |
101 | 103 | ||
102 | bar_run(&swaybar); | 104 | bar_run(&swaybar); |
103 | |||
104 | // gracefully shutdown swaybar and status_command | ||
105 | bar_teardown(&swaybar); | 105 | bar_teardown(&swaybar); |
106 | |||
107 | return 0; | 106 | return 0; |
108 | } | 107 | } |