aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/background-image.c10
-rw-r--r--common/ipc-client.c2
-rw-r--r--common/log.c89
-rw-r--r--common/loop.c6
-rw-r--r--common/pango.c6
-rw-r--r--common/util.c4
-rw-r--r--include/log.h44
-rw-r--r--meson.build2
-rw-r--r--sway/commands.c16
-rw-r--r--sway/commands/assign.c2
-rw-r--r--sway/commands/bar.c8
-rw-r--r--sway/commands/bar/bind.c4
-rw-r--r--sway/commands/bar/binding_mode_indicator.c4
-rw-r--r--sway/commands/bar/font.c2
-rw-r--r--sway/commands/bar/gaps.c2
-rw-r--r--sway/commands/bar/height.c2
-rw-r--r--sway/commands/bar/hidden_state.c2
-rw-r--r--sway/commands/bar/icon_theme.c2
-rw-r--r--sway/commands/bar/id.c2
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/commands/bar/modifier.c2
-rw-r--r--sway/commands/bar/output.c2
-rw-r--r--sway/commands/bar/pango_markup.c4
-rw-r--r--sway/commands/bar/position.c2
-rw-r--r--sway/commands/bar/separator_symbol.c2
-rw-r--r--sway/commands/bar/status_command.c2
-rw-r--r--sway/commands/bar/status_edge_padding.c2
-rw-r--r--sway/commands/bar/status_padding.c2
-rw-r--r--sway/commands/bar/strip_workspace_name.c4
-rw-r--r--sway/commands/bar/strip_workspace_numbers.c4
-rw-r--r--sway/commands/bar/swaybar_command.c2
-rw-r--r--sway/commands/bar/tray_bind.c4
-rw-r--r--sway/commands/bar/tray_output.c4
-rw-r--r--sway/commands/bar/tray_padding.c2
-rw-r--r--sway/commands/bar/workspace_buttons.c4
-rw-r--r--sway/commands/bar/wrap_scroll.c4
-rw-r--r--sway/commands/bind.c8
-rw-r--r--sway/commands/client.c2
-rw-r--r--sway/commands/exec.c2
-rw-r--r--sway/commands/exec_always.c8
-rw-r--r--sway/commands/floating_minmax_size.c1
-rw-r--r--sway/commands/focus.c1
-rw-r--r--sway/commands/for_window.c2
-rw-r--r--sway/commands/input.c2
-rw-r--r--sway/commands/input/xkb_layout.c2
-rw-r--r--sway/commands/input/xkb_model.c2
-rw-r--r--sway/commands/input/xkb_options.c2
-rw-r--r--sway/commands/input/xkb_rules.c2
-rw-r--r--sway/commands/input/xkb_variant.c2
-rw-r--r--sway/commands/kill.c1
-rw-r--r--sway/commands/mode.c2
-rw-r--r--sway/commands/move.c15
-rw-r--r--sway/commands/output.c2
-rw-r--r--sway/commands/output/background.c8
-rw-r--r--sway/commands/reload.c2
-rw-r--r--sway/commands/rename.c2
-rw-r--r--sway/commands/resize.c1
-rw-r--r--sway/commands/scratchpad.c8
-rw-r--r--sway/commands/swap.c3
-rw-r--r--sway/commands/swaybg_command.c2
-rw-r--r--sway/commands/swaynag_command.c2
-rw-r--r--sway/commands/xwayland.c2
-rw-r--r--sway/config.c50
-rw-r--r--sway/config/bar.c14
-rw-r--r--sway/config/input.c18
-rw-r--r--sway/config/output.c44
-rw-r--r--sway/config/seat.c16
-rw-r--r--sway/criteria.c2
-rw-r--r--sway/debug-tree.c1
-rw-r--r--sway/desktop/idle_inhibit_v1.c4
-rw-r--r--sway/desktop/layer_shell.c9
-rw-r--r--sway/desktop/output.c4
-rw-r--r--sway/desktop/transaction.c14
-rw-r--r--sway/desktop/xdg_shell.c4
-rw-r--r--sway/desktop/xdg_shell_v6.c4
-rw-r--r--sway/desktop/xwayland.c10
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/input/input-manager.c84
-rw-r--r--sway/input/keyboard.c10
-rw-r--r--sway/input/seat.c32
-rw-r--r--sway/ipc-server.c70
-rw-r--r--sway/main.c39
-rw-r--r--sway/server.c18
-rw-r--r--sway/swaynag.c8
-rw-r--r--sway/tree/arrange.c8
-rw-r--r--sway/tree/container.c6
-rw-r--r--sway/tree/output.c10
-rw-r--r--sway/tree/root.c14
-rw-r--r--sway/tree/view.c14
-rw-r--r--sway/tree/workspace.c18
-rw-r--r--swaybar/bar.c7
-rw-r--r--swaybar/config.c4
-rw-r--r--swaybar/i3bar.c14
-rw-r--r--swaybar/input.c3
-rw-r--r--swaybar/ipc.c14
-rw-r--r--swaybar/main.c10
-rw-r--r--swaybar/render.c1
-rw-r--r--swaybar/status_line.c18
-rw-r--r--swaybar/tray/host.c30
-rw-r--r--swaybar/tray/icon.c2
-rw-r--r--swaybar/tray/item.c40
-rw-r--r--swaybar/tray/tray.c10
-rw-r--r--swaybar/tray/watcher.c26
-rw-r--r--swaybg/main.c14
-rw-r--r--swaymsg/main.c4
-rw-r--r--swaynag/main.c20
-rw-r--r--swaynag/render.c2
-rw-r--r--swaynag/swaynag.c20
108 files changed, 610 insertions, 501 deletions
diff --git a/common/background-image.c b/common/background-image.c
index 72f39a79..d15c2989 100644
--- a/common/background-image.c
+++ b/common/background-image.c
@@ -1,8 +1,8 @@
1#include <assert.h> 1#include <assert.h>
2#include <stdbool.h> 2#include <stdbool.h>
3#include <wlr/util/log.h>
4#include "background-image.h" 3#include "background-image.h"
5#include "cairo.h" 4#include "cairo.h"
5#include "log.h"
6 6
7enum background_mode parse_background_mode(const char *mode) { 7enum background_mode parse_background_mode(const char *mode) {
8 if (strcmp(mode, "stretch") == 0) { 8 if (strcmp(mode, "stretch") == 0) {
@@ -18,7 +18,7 @@ enum background_mode parse_background_mode(const char *mode) {
18 } else if (strcmp(mode, "solid_color") == 0) { 18 } else if (strcmp(mode, "solid_color") == 0) {
19 return BACKGROUND_MODE_SOLID_COLOR; 19 return BACKGROUND_MODE_SOLID_COLOR;
20 } 20 }
21 wlr_log(WLR_ERROR, "Unsupported background mode: %s", mode); 21 sway_log(SWAY_ERROR, "Unsupported background mode: %s", mode);
22 return BACKGROUND_MODE_INVALID; 22 return BACKGROUND_MODE_INVALID;
23} 23}
24 24
@@ -28,7 +28,7 @@ cairo_surface_t *load_background_image(const char *path) {
28 GError *err = NULL; 28 GError *err = NULL;
29 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err); 29 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err);
30 if (!pixbuf) { 30 if (!pixbuf) {
31 wlr_log(WLR_ERROR, "Failed to load background image (%s).", 31 sway_log(SWAY_ERROR, "Failed to load background image (%s).",
32 err->message); 32 err->message);
33 return false; 33 return false;
34 } 34 }
@@ -38,11 +38,11 @@ cairo_surface_t *load_background_image(const char *path) {
38 image = cairo_image_surface_create_from_png(path); 38 image = cairo_image_surface_create_from_png(path);
39#endif // HAVE_GDK_PIXBUF 39#endif // HAVE_GDK_PIXBUF
40 if (!image) { 40 if (!image) {
41 wlr_log(WLR_ERROR, "Failed to read background image."); 41 sway_log(SWAY_ERROR, "Failed to read background image.");
42 return NULL; 42 return NULL;
43 } 43 }
44 if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) { 44 if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) {
45 wlr_log(WLR_ERROR, "Failed to read background image: %s." 45 sway_log(SWAY_ERROR, "Failed to read background image: %s."
46#if !HAVE_GDK_PIXBUF 46#if !HAVE_GDK_PIXBUF
47 "\nSway was compiled without gdk_pixbuf support, so only" 47 "\nSway was compiled without gdk_pixbuf support, so only"
48 "\nPNG images can be loaded. This is the likely cause." 48 "\nPNG images can be loaded. This is the likely cause."
diff --git a/common/ipc-client.c b/common/ipc-client.c
index 79ed3555..13e2dfa3 100644
--- a/common/ipc-client.c
+++ b/common/ipc-client.c
@@ -111,7 +111,7 @@ error_2:
111 free(response); 111 free(response);
112 free(payload); 112 free(payload);
113error_1: 113error_1:
114 wlr_log(WLR_ERROR, "Unable to allocate memory for IPC response"); 114 sway_log(SWAY_ERROR, "Unable to allocate memory for IPC response");
115 return NULL; 115 return NULL;
116} 116}
117 117
diff --git a/common/log.c b/common/log.c
index 847f3952..669fd360 100644
--- a/common/log.c
+++ b/common/log.c
@@ -1,16 +1,20 @@
1#define _POSIX_C_SOURCE 199506L
1#include <signal.h> 2#include <signal.h>
2#include <stdarg.h> 3#include <stdarg.h>
4#include <stdio.h>
3#include <stdlib.h> 5#include <stdlib.h>
6#include <time.h>
7#include <unistd.h>
4#include "log.h" 8#include "log.h"
5 9
6void sway_terminate(int code); 10static terminate_callback_t log_terminate = exit;
7 11
8void _sway_abort(const char *format, ...) { 12void _sway_abort(const char *format, ...) {
9 va_list args; 13 va_list args;
10 va_start(args, format); 14 va_start(args, format);
11 _wlr_vlog(WLR_ERROR, format, args); 15 _sway_vlog(SWAY_ERROR, format, args);
12 va_end(args); 16 va_end(args);
13 sway_terminate(EXIT_FAILURE); 17 log_terminate(EXIT_FAILURE);
14} 18}
15 19
16bool _sway_assert(bool condition, const char *format, ...) { 20bool _sway_assert(bool condition, const char *format, ...) {
@@ -20,7 +24,7 @@ bool _sway_assert(bool condition, const char *format, ...) {
20 24
21 va_list args; 25 va_list args;
22 va_start(args, format); 26 va_start(args, format);
23 _wlr_vlog(WLR_ERROR, format, args); 27 _sway_vlog(SWAY_ERROR, format, args);
24 va_end(args); 28 va_end(args);
25 29
26#ifndef NDEBUG 30#ifndef NDEBUG
@@ -29,3 +33,80 @@ bool _sway_assert(bool condition, const char *format, ...) {
29 33
30 return false; 34 return false;
31} 35}
36
37static bool colored = true;
38static sway_log_importance_t log_importance = SWAY_ERROR;
39
40static const char *verbosity_colors[] = {
41 [SWAY_SILENT] = "",
42 [SWAY_ERROR ] = "\x1B[1;31m",
43 [SWAY_INFO ] = "\x1B[1;34m",
44 [SWAY_DEBUG ] = "\x1B[1;30m",
45};
46
47static void sway_log_stderr(sway_log_importance_t verbosity, const char *fmt,
48 va_list args) {
49 if (verbosity > log_importance) {
50 return;
51 }
52 // prefix the time to the log message
53 struct tm result;
54 time_t t = time(NULL);
55 struct tm *tm_info = localtime_r(&t, &result);
56 char buffer[26];
57
58 // generate time prefix
59 strftime(buffer, sizeof(buffer), "%F %T - ", tm_info);
60 fprintf(stderr, "%s", buffer);
61
62 unsigned c = (verbosity < SWAY_LOG_IMPORTANCE_LAST) ? verbosity :
63 SWAY_LOG_IMPORTANCE_LAST - 1;
64
65 if (colored && isatty(STDERR_FILENO)) {
66 fprintf(stderr, "%s", verbosity_colors[c]);
67 }
68
69 vfprintf(stderr, fmt, args);
70
71 if (colored && isatty(STDERR_FILENO)) {
72 fprintf(stderr, "\x1B[0m");
73 }
74 fprintf(stderr, "\n");
75}
76
77void sway_log_init(sway_log_importance_t verbosity, terminate_callback_t callback) {
78 if (verbosity < SWAY_LOG_IMPORTANCE_LAST) {
79 log_importance = verbosity;
80 }
81 if (callback) {
82 log_terminate = callback;
83 }
84}
85
86void _sway_vlog(sway_log_importance_t verbosity, const char *fmt, va_list args) {
87 sway_log_stderr(verbosity, fmt, args);
88}
89
90void _sway_log(sway_log_importance_t verbosity, const char *fmt, ...) {
91 va_list args;
92 va_start(args, fmt);
93 sway_log_stderr(verbosity, fmt, args);
94 va_end(args);
95}
96
97// strips the path prefix from filepath
98// will try to strip SWAY_SRC_DIR as well as a relative src dir
99// e.g. '/src/build/sway/util/log.c' and
100// '../util/log.c' will both be stripped to
101// 'util/log.c'
102const char *_sway_strip_path(const char *filepath) {
103 static int srclen = sizeof(SWAY_SRC_DIR);
104 if (strstr(filepath, SWAY_SRC_DIR) == filepath) {
105 filepath += srclen;
106 } else if (*filepath == '.') {
107 while (*filepath == '.' || *filepath == '/') {
108 ++filepath;
109 }
110 }
111 return filepath;
112}
diff --git a/common/loop.c b/common/loop.c
index 295f3a30..aecad2f3 100644
--- a/common/loop.c
+++ b/common/loop.c
@@ -34,7 +34,7 @@ struct loop {
34struct loop *loop_create(void) { 34struct loop *loop_create(void) {
35 struct loop *loop = calloc(1, sizeof(struct loop)); 35 struct loop *loop = calloc(1, sizeof(struct loop));
36 if (!loop) { 36 if (!loop) {
37 wlr_log(WLR_ERROR, "Unable to allocate memory for loop"); 37 sway_log(SWAY_ERROR, "Unable to allocate memory for loop");
38 return NULL; 38 return NULL;
39 } 39 }
40 loop->fd_capacity = 10; 40 loop->fd_capacity = 10;
@@ -107,7 +107,7 @@ void loop_add_fd(struct loop *loop, int fd, short mask,
107 void (*callback)(int fd, short mask, void *data), void *data) { 107 void (*callback)(int fd, short mask, void *data), void *data) {
108 struct loop_fd_event *event = calloc(1, sizeof(struct loop_fd_event)); 108 struct loop_fd_event *event = calloc(1, sizeof(struct loop_fd_event));
109 if (!event) { 109 if (!event) {
110 wlr_log(WLR_ERROR, "Unable to allocate memory for event"); 110 sway_log(SWAY_ERROR, "Unable to allocate memory for event");
111 return; 111 return;
112 } 112 }
113 event->callback = callback; 113 event->callback = callback;
@@ -129,7 +129,7 @@ struct loop_timer *loop_add_timer(struct loop *loop, int ms,
129 void (*callback)(void *data), void *data) { 129 void (*callback)(void *data), void *data) {
130 struct loop_timer *timer = calloc(1, sizeof(struct loop_timer)); 130 struct loop_timer *timer = calloc(1, sizeof(struct loop_timer));
131 if (!timer) { 131 if (!timer) {
132 wlr_log(WLR_ERROR, "Unable to allocate memory for timer"); 132 sway_log(SWAY_ERROR, "Unable to allocate memory for timer");
133 return NULL; 133 return NULL;
134 } 134 }
135 timer->callback = callback; 135 timer->callback = callback;
diff --git a/common/pango.c b/common/pango.c
index 7e164043..fc3d0688 100644
--- a/common/pango.c
+++ b/common/pango.c
@@ -61,7 +61,7 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
61 pango_layout_set_text(layout, buf, -1); 61 pango_layout_set_text(layout, buf, -1);
62 free(buf); 62 free(buf);
63 } else { 63 } else {
64 wlr_log(WLR_ERROR, "pango_parse_markup '%s' -> error %s", text, 64 sway_log(SWAY_ERROR, "pango_parse_markup '%s' -> error %s", text,
65 error->message); 65 error->message);
66 g_error_free(error); 66 g_error_free(error);
67 markup = false; // fallback to plain text 67 markup = false; // fallback to plain text
@@ -92,7 +92,7 @@ void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
92 92
93 char *buf = malloc(length); 93 char *buf = malloc(length);
94 if (buf == NULL) { 94 if (buf == NULL) {
95 wlr_log(WLR_ERROR, "Failed to allocate memory"); 95 sway_log(SWAY_ERROR, "Failed to allocate memory");
96 return; 96 return;
97 } 97 }
98 va_start(args, fmt); 98 va_start(args, fmt);
@@ -119,7 +119,7 @@ void pango_printf(cairo_t *cairo, const char *font,
119 119
120 char *buf = malloc(length); 120 char *buf = malloc(length);
121 if (buf == NULL) { 121 if (buf == NULL) {
122 wlr_log(WLR_ERROR, "Failed to allocate memory"); 122 sway_log(SWAY_ERROR, "Failed to allocate memory");
123 return; 123 return;
124 } 124 }
125 va_start(args, fmt); 125 va_start(args, fmt);
diff --git a/common/util.c b/common/util.c
index d66058a6..27039dcb 100644
--- a/common/util.c
+++ b/common/util.c
@@ -116,7 +116,7 @@ uint32_t parse_color(const char *color) {
116 116
117 int len = strlen(color); 117 int len = strlen(color);
118 if (len != 6 && len != 8) { 118 if (len != 6 && len != 8) {
119 wlr_log(WLR_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); 119 sway_log(SWAY_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
120 return 0xFFFFFFFF; 120 return 0xFFFFFFFF;
121 } 121 }
122 uint32_t res = (uint32_t)strtoul(color, NULL, 16); 122 uint32_t res = (uint32_t)strtoul(color, NULL, 16);
@@ -147,7 +147,7 @@ float parse_float(const char *value) {
147 char *end; 147 char *end;
148 float flt = strtof(value, &end); 148 float flt = strtof(value, &end);
149 if (*end || errno) { 149 if (*end || errno) {
150 wlr_log(WLR_DEBUG, "Invalid float value '%s', defaulting to NAN", value); 150 sway_log(SWAY_DEBUG, "Invalid float value '%s', defaulting to NAN", value);
151 return NAN; 151 return NAN;
152 } 152 }
153 return flt; 153 return flt;
diff --git a/include/log.h b/include/log.h
index 6fb2f277..adf431ab 100644
--- a/include/log.h
+++ b/include/log.h
@@ -1,7 +1,18 @@
1#ifndef _SWAY_LOG_H 1#ifndef _SWAY_LOG_H
2#define _SWAY_LOG_H 2#define _SWAY_LOG_H
3
3#include <stdbool.h> 4#include <stdbool.h>
4#include <wlr/util/log.h> 5#include <stdarg.h>
6#include <string.h>
7#include <errno.h>
8
9typedef enum {
10 SWAY_SILENT = 0,
11 SWAY_ERROR = 1,
12 SWAY_INFO = 2,
13 SWAY_DEBUG = 3,
14 SWAY_LOG_IMPORTANCE_LAST,
15} sway_log_importance_t;
5 16
6#ifdef __GNUC__ 17#ifdef __GNUC__
7#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) 18#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
@@ -9,14 +20,35 @@
9#define ATTRIB_PRINTF(start, end) 20#define ATTRIB_PRINTF(start, end)
10#endif 21#endif
11 22
23void error_handler(int sig);
24
25typedef void (*terminate_callback_t)(int exit_code);
26
27// Will log all messages less than or equal to `verbosity`
28// The `terminate` callback is called by `sway_abort`
29void sway_log_init(sway_log_importance_t verbosity, terminate_callback_t terminate);
30
31void _sway_log(sway_log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3);
32void _sway_vlog(sway_log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0);
12void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2); 33void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2);
34bool _sway_assert(bool condition, const char* format, ...) ATTRIB_PRINTF(2, 3);
35
36// TODO: get meson to precompute this, for better reproducibility/less overhead
37const char *_sway_strip_path(const char *filepath);
38
39#define sway_log(verb, fmt, ...) \
40 _sway_log(verb, "[%s:%d] " fmt, _sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
41
42#define sway_vlog(verb, fmt, args) \
43 _sway_vlog(verb, "[%s:%d] " fmt, _sway_strip_path(__FILE__), __LINE__, args)
44
45#define sway_log_errno(verb, fmt, ...) \
46 sway_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))
47
13#define sway_abort(FMT, ...) \ 48#define sway_abort(FMT, ...) \
14 _sway_abort("[%s:%d] " FMT, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) 49 _sway_abort("[%s:%d] " FMT, _sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
15 50
16bool _sway_assert(bool condition, const char* format, ...) ATTRIB_PRINTF(2, 3);
17#define sway_assert(COND, FMT, ...) \ 51#define sway_assert(COND, FMT, ...) \
18 _sway_assert(COND, "[%s:%d] %s:" FMT, _wlr_strip_path(__FILE__), __LINE__, __func__, ##__VA_ARGS__) 52 _sway_assert(COND, "[%s:%d] %s:" FMT, _sway_strip_path(__FILE__), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
19
20void error_handler(int sig);
21 53
22#endif 54#endif
diff --git a/meson.build b/meson.build
index 0d0f7339..f0a06b08 100644
--- a/meson.build
+++ b/meson.build
@@ -12,6 +12,8 @@ project(
12 12
13add_project_arguments( 13add_project_arguments(
14 [ 14 [
15 '-DSWAY_SRC_DIR="@0@"'.format(meson.current_source_dir()),
16
15 '-DWL_HIDE_DEPRECATED', 17 '-DWL_HIDE_DEPRECATED',
16 '-DWLR_USE_UNSTABLE', 18 '-DWLR_USE_UNSTABLE',
17 19
diff --git a/sway/commands.c b/sway/commands.c
index 6f786035..f92a5e46 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -142,7 +142,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
142 int handlers_size) { 142 int handlers_size) {
143 struct cmd_handler d = { .command=line }; 143 struct cmd_handler d = { .command=line };
144 struct cmd_handler *res = NULL; 144 struct cmd_handler *res = NULL;
145 wlr_log(WLR_DEBUG, "find_handler(%s)", line); 145 sway_log(SWAY_DEBUG, "find_handler(%s)", line);
146 146
147 bool config_loading = config->reading || !config->active; 147 bool config_loading = config->reading || !config->active;
148 148
@@ -247,10 +247,10 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
247 cmd = argsep(&cmdlist, ","); 247 cmd = argsep(&cmdlist, ",");
248 for (; isspace(*cmd); ++cmd) {} 248 for (; isspace(*cmd); ++cmd) {}
249 if (strcmp(cmd, "") == 0) { 249 if (strcmp(cmd, "") == 0) {
250 wlr_log(WLR_INFO, "Ignoring empty command."); 250 sway_log(SWAY_INFO, "Ignoring empty command.");
251 continue; 251 continue;
252 } 252 }
253 wlr_log(WLR_INFO, "Handling command '%s'", cmd); 253 sway_log(SWAY_INFO, "Handling command '%s'", cmd);
254 //TODO better handling of argv 254 //TODO better handling of argv
255 int argc; 255 int argc;
256 char **argv = split_args(cmd, &argc); 256 char **argv = split_args(cmd, &argc);
@@ -353,7 +353,7 @@ struct cmd_results *config_command(char *exec, char **new_block) {
353 } 353 }
354 354
355 // Determine the command handler 355 // Determine the command handler
356 wlr_log(WLR_INFO, "Config command: %s", exec); 356 sway_log(SWAY_INFO, "Config command: %s", exec);
357 struct cmd_handler *handler = find_handler(argv[0], NULL, 0); 357 struct cmd_handler *handler = find_handler(argv[0], NULL, 0);
358 if (!handler || !handler->handle) { 358 if (!handler || !handler->handle) {
359 const char *error = handler 359 const char *error = handler
@@ -373,7 +373,7 @@ struct cmd_results *config_command(char *exec, char **new_block) {
373 argv[1] = temp; 373 argv[1] = temp;
374 } 374 }
375 char *command = do_var_replacement(join_args(argv, argc)); 375 char *command = do_var_replacement(join_args(argv, argc));
376 wlr_log(WLR_INFO, "After replacement: %s", command); 376 sway_log(SWAY_INFO, "After replacement: %s", command);
377 free_argv(argc, argv); 377 free_argv(argc, argv);
378 argv = split_args(command, &argc); 378 argv = split_args(command, &argc);
379 free(command); 379 free(command);
@@ -402,7 +402,7 @@ cleanup:
402struct cmd_results *config_subcommand(char **argv, int argc, 402struct cmd_results *config_subcommand(char **argv, int argc,
403 struct cmd_handler *handlers, size_t handlers_size) { 403 struct cmd_handler *handlers, size_t handlers_size) {
404 char *command = join_args(argv, argc); 404 char *command = join_args(argv, argc);
405 wlr_log(WLR_DEBUG, "Subcommand: %s", command); 405 sway_log(SWAY_DEBUG, "Subcommand: %s", command);
406 free(command); 406 free(command);
407 407
408 struct cmd_handler *handler = find_handler(argv[0], handlers, 408 struct cmd_handler *handler = find_handler(argv[0], handlers,
@@ -489,7 +489,7 @@ struct cmd_results *config_commands_command(char *exec) {
489 } 489 }
490 policy->context = context; 490 policy->context = context;
491 491
492 wlr_log(WLR_INFO, "Set command policy for %s to %d", 492 sway_log(SWAY_INFO, "Set command policy for %s to %d",
493 policy->command, policy->context); 493 policy->command, policy->context);
494 494
495 results = cmd_results_new(CMD_SUCCESS, NULL); 495 results = cmd_results_new(CMD_SUCCESS, NULL);
@@ -503,7 +503,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
503 const char *format, ...) { 503 const char *format, ...) {
504 struct cmd_results *results = malloc(sizeof(struct cmd_results)); 504 struct cmd_results *results = malloc(sizeof(struct cmd_results));
505 if (!results) { 505 if (!results) {
506 wlr_log(WLR_ERROR, "Unable to allocate command results"); 506 sway_log(SWAY_ERROR, "Unable to allocate command results");
507 return NULL; 507 return NULL;
508 } 508 }
509 results->status = status; 509 results->status = status;
diff --git a/sway/commands/assign.c b/sway/commands/assign.c
index 3bd1f65d..976bc3cc 100644
--- a/sway/commands/assign.c
+++ b/sway/commands/assign.c
@@ -56,7 +56,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
56 criteria->target = join_args(argv, argc); 56 criteria->target = join_args(argv, argc);
57 57
58 list_add(config->criteria, criteria); 58 list_add(config->criteria, criteria);
59 wlr_log(WLR_DEBUG, "assign: '%s' -> '%s' added", criteria->raw, 59 sway_log(SWAY_DEBUG, "assign: '%s' -> '%s' added", criteria->raw,
60 criteria->target); 60 criteria->target);
61 61
62 return cmd_results_new(CMD_SUCCESS, NULL); 62 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index 2cfc538f..e9360603 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -1,9 +1,9 @@
1#define _POSIX_C_SOURCE 200809 1#define _POSIX_C_SOURCE 200809
2#include <string.h> 2#include <string.h>
3#include <strings.h> 3#include <strings.h>
4#include <wlr/util/log.h>
5#include "sway/commands.h" 4#include "sway/commands.h"
6#include "sway/config.h" 5#include "sway/config.h"
6#include "log.h"
7#include "util.h" 7#include "util.h"
8 8
9// Must be in alphabetical order for bsearch 9// Must be in alphabetical order for bsearch
@@ -60,14 +60,14 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
60 for (int i = 0; i < config->bars->length; ++i) { 60 for (int i = 0; i < config->bars->length; ++i) {
61 struct bar_config *item = config->bars->items[i]; 61 struct bar_config *item = config->bars->items[i];
62 if (strcmp(item->id, argv[0]) == 0) { 62 if (strcmp(item->id, argv[0]) == 0) {
63 wlr_log(WLR_DEBUG, "Selecting bar: %s", argv[0]); 63 sway_log(SWAY_DEBUG, "Selecting bar: %s", argv[0]);
64 bar = item; 64 bar = item;
65 break; 65 break;
66 } 66 }
67 } 67 }
68 if (!bar) { 68 if (!bar) {
69 spawn = !config->reading; 69 spawn = !config->reading;
70 wlr_log(WLR_DEBUG, "Creating bar: %s", argv[0]); 70 sway_log(SWAY_DEBUG, "Creating bar: %s", argv[0]);
71 bar = default_bar_config(); 71 bar = default_bar_config();
72 if (!bar) { 72 if (!bar) {
73 return cmd_results_new(CMD_FAILURE, 73 return cmd_results_new(CMD_FAILURE,
@@ -99,7 +99,7 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
99 99
100 // Set current bar 100 // Set current bar
101 config->current_bar = bar; 101 config->current_bar = bar;
102 wlr_log(WLR_DEBUG, "Creating bar %s", bar->id); 102 sway_log(SWAY_DEBUG, "Creating bar %s", bar->id);
103 } 103 }
104 104
105 if (find_handler(argv[0], bar_config_handlers, 105 if (find_handler(argv[0], bar_config_handlers,
diff --git a/sway/commands/bar/bind.c b/sway/commands/bar/bind.c
index 4b0be804..17030a05 100644
--- a/sway/commands/bar/bind.c
+++ b/sway/commands/bar/bind.c
@@ -59,7 +59,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
59 overwritten = true; 59 overwritten = true;
60 bindings->items[i] = binding; 60 bindings->items[i] = binding;
61 free_bar_binding(other); 61 free_bar_binding(other);
62 wlr_log(WLR_DEBUG, "[bar %s] Updated binding for %u (%s)%s", 62 sway_log(SWAY_DEBUG, "[bar %s] Updated binding for %u (%s)%s",
63 config->current_bar->id, binding->button, name, 63 config->current_bar->id, binding->button, name,
64 binding->release ? " - release" : ""); 64 binding->release ? " - release" : "");
65 break; 65 break;
@@ -67,7 +67,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
67 } 67 }
68 if (!overwritten) { 68 if (!overwritten) {
69 list_add(bindings, binding); 69 list_add(bindings, binding);
70 wlr_log(WLR_DEBUG, "[bar %s] Added binding for %u (%s)%s", 70 sway_log(SWAY_DEBUG, "[bar %s] Added binding for %u (%s)%s",
71 config->current_bar->id, binding->button, name, 71 config->current_bar->id, binding->button, name,
72 binding->release ? " - release" : ""); 72 binding->release ? " - release" : "");
73 } 73 }
diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/commands/bar/binding_mode_indicator.c
index 15acc309..29c93ddc 100644
--- a/sway/commands/bar/binding_mode_indicator.c
+++ b/sway/commands/bar/binding_mode_indicator.c
@@ -16,10 +16,10 @@ struct cmd_results *bar_cmd_binding_mode_indicator(int argc, char **argv) {
16 config->current_bar->binding_mode_indicator = 16 config->current_bar->binding_mode_indicator =
17 parse_boolean(argv[0], config->current_bar->binding_mode_indicator); 17 parse_boolean(argv[0], config->current_bar->binding_mode_indicator);
18 if (config->current_bar->binding_mode_indicator) { 18 if (config->current_bar->binding_mode_indicator) {
19 wlr_log(WLR_DEBUG, "Enabling binding mode indicator on bar: %s", 19 sway_log(SWAY_DEBUG, "Enabling binding mode indicator on bar: %s",
20 config->current_bar->id); 20 config->current_bar->id);
21 } else { 21 } else {
22 wlr_log(WLR_DEBUG, "Disabling binding mode indicator on bar: %s", 22 sway_log(SWAY_DEBUG, "Disabling binding mode indicator on bar: %s",
23 config->current_bar->id); 23 config->current_bar->id);
24 } 24 }
25 return cmd_results_new(CMD_SUCCESS, NULL); 25 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bar/font.c b/sway/commands/bar/font.c
index c6147e3d..cf1f759e 100644
--- a/sway/commands/bar/font.c
+++ b/sway/commands/bar/font.c
@@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
15 char *font = join_args(argv, argc); 15 char *font = join_args(argv, argc);
16 free(config->current_bar->font); 16 free(config->current_bar->font);
17 config->current_bar->font = font; 17 config->current_bar->font = font;
18 wlr_log(WLR_DEBUG, "Settings font '%s' for bar: %s", 18 sway_log(SWAY_DEBUG, "Settings font '%s' for bar: %s",
19 config->current_bar->font, config->current_bar->id); 19 config->current_bar->font, config->current_bar->id);
20 return cmd_results_new(CMD_SUCCESS, NULL); 20 return cmd_results_new(CMD_SUCCESS, NULL);
21} 21}
diff --git a/sway/commands/bar/gaps.c b/sway/commands/bar/gaps.c
index fabe12fc..83480fb5 100644
--- a/sway/commands/bar/gaps.c
+++ b/sway/commands/bar/gaps.c
@@ -47,7 +47,7 @@ struct cmd_results *bar_cmd_gaps(int argc, char **argv) {
47 config->current_bar->gaps.bottom = bottom; 47 config->current_bar->gaps.bottom = bottom;
48 config->current_bar->gaps.left = left; 48 config->current_bar->gaps.left = left;
49 49
50 wlr_log(WLR_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s", 50 sway_log(SWAY_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s",
51 config->current_bar->gaps.top, config->current_bar->gaps.right, 51 config->current_bar->gaps.top, config->current_bar->gaps.right,
52 config->current_bar->gaps.bottom, config->current_bar->gaps.left, 52 config->current_bar->gaps.bottom, config->current_bar->gaps.left,
53 config->current_bar->id); 53 config->current_bar->id);
diff --git a/sway/commands/bar/height.c b/sway/commands/bar/height.c
index a2e72533..945eb707 100644
--- a/sway/commands/bar/height.c
+++ b/sway/commands/bar/height.c
@@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_height(int argc, char **argv) {
14 "Invalid height value: %s", argv[0]); 14 "Invalid height value: %s", argv[0]);
15 } 15 }
16 config->current_bar->height = height; 16 config->current_bar->height = height;
17 wlr_log(WLR_DEBUG, "Setting bar height to %d on bar: %s", 17 sway_log(SWAY_DEBUG, "Setting bar height to %d on bar: %s",
18 height, config->current_bar->id); 18 height, config->current_bar->id);
19 return cmd_results_new(CMD_SUCCESS, NULL); 19 return cmd_results_new(CMD_SUCCESS, NULL);
20} 20}
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index 3364ce70..b2c2d245 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -26,7 +26,7 @@ static struct cmd_results *bar_set_hidden_state(struct bar_config *bar,
26 if (!config->reading) { 26 if (!config->reading) {
27 ipc_event_barconfig_update(bar); 27 ipc_event_barconfig_update(bar);
28 } 28 }
29 wlr_log(WLR_DEBUG, "Setting hidden_state: '%s' for bar: %s", 29 sway_log(SWAY_DEBUG, "Setting hidden_state: '%s' for bar: %s",
30 bar->hidden_state, bar->id); 30 bar->hidden_state, bar->id);
31 } 31 }
32 // free old mode 32 // free old mode
diff --git a/sway/commands/bar/icon_theme.c b/sway/commands/bar/icon_theme.c
index 2d16f748..54b7b16e 100644
--- a/sway/commands/bar/icon_theme.c
+++ b/sway/commands/bar/icon_theme.c
@@ -16,7 +16,7 @@ struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) {
16 return cmd_results_new(CMD_FAILURE, "No bar defined."); 16 return cmd_results_new(CMD_FAILURE, "No bar defined.");
17 } 17 }
18 18
19 wlr_log(WLR_DEBUG, "[Bar %s] Setting icon theme to %s", 19 sway_log(SWAY_DEBUG, "[Bar %s] Setting icon theme to %s",
20 config->current_bar->id, argv[0]); 20 config->current_bar->id, argv[0]);
21 free(config->current_bar->icon_theme); 21 free(config->current_bar->icon_theme);
22 config->current_bar->icon_theme = strdup(argv[0]); 22 config->current_bar->icon_theme = strdup(argv[0]);
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
index bef3023b..a9a61743 100644
--- a/sway/commands/bar/id.c
+++ b/sway/commands/bar/id.c
@@ -26,7 +26,7 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
26 } 26 }
27 } 27 }
28 28
29 wlr_log(WLR_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name); 29 sway_log(SWAY_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
30 30
31 // free old bar id 31 // free old bar id
32 free(config->current_bar->id); 32 free(config->current_bar->id);
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 1698db8d..d89ddf24 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -28,7 +28,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
28 if (!config->reading) { 28 if (!config->reading) {
29 ipc_event_barconfig_update(bar); 29 ipc_event_barconfig_update(bar);
30 } 30 }
31 wlr_log(WLR_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id); 31 sway_log(SWAY_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
32 } 32 }
33 33
34 // free old mode 34 // free old mode
diff --git a/sway/commands/bar/modifier.c b/sway/commands/bar/modifier.c
index 0d28d6a2..62ec681f 100644
--- a/sway/commands/bar/modifier.c
+++ b/sway/commands/bar/modifier.c
@@ -29,7 +29,7 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
29 } 29 }
30 list_free_items_and_destroy(split); 30 list_free_items_and_destroy(split);
31 config->current_bar->modifier = mod; 31 config->current_bar->modifier = mod;
32 wlr_log(WLR_DEBUG, 32 sway_log(SWAY_DEBUG,
33 "Show/Hide the bar when pressing '%s' in hide mode.", argv[0]); 33 "Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
34 return cmd_results_new(CMD_SUCCESS, NULL); 34 return cmd_results_new(CMD_SUCCESS, NULL);
35} 35}
diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c
index 9ad10678..956c1959 100644
--- a/sway/commands/bar/output.c
+++ b/sway/commands/bar/output.c
@@ -42,7 +42,7 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
42 42
43 if (add_output) { 43 if (add_output) {
44 list_add(outputs, strdup(output)); 44 list_add(outputs, strdup(output));
45 wlr_log(WLR_DEBUG, "Adding bar: '%s' to output '%s'", 45 sway_log(SWAY_DEBUG, "Adding bar: '%s' to output '%s'",
46 config->current_bar->id, output); 46 config->current_bar->id, output);
47 } 47 }
48 return cmd_results_new(CMD_SUCCESS, NULL); 48 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bar/pango_markup.c b/sway/commands/bar/pango_markup.c
index 0ffa41d9..b0958cf1 100644
--- a/sway/commands/bar/pango_markup.c
+++ b/sway/commands/bar/pango_markup.c
@@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) {
15 config->current_bar->pango_markup 15 config->current_bar->pango_markup
16 = parse_boolean(argv[0], config->current_bar->pango_markup); 16 = parse_boolean(argv[0], config->current_bar->pango_markup);
17 if (config->current_bar->pango_markup) { 17 if (config->current_bar->pango_markup) {
18 wlr_log(WLR_DEBUG, "Enabling pango markup for bar: %s", 18 sway_log(SWAY_DEBUG, "Enabling pango markup for bar: %s",
19 config->current_bar->id); 19 config->current_bar->id);
20 } else { 20 } else {
21 wlr_log(WLR_DEBUG, "Disabling pango markup for bar: %s", 21 sway_log(SWAY_DEBUG, "Disabling pango markup for bar: %s",
22 config->current_bar->id); 22 config->current_bar->id);
23 } 23 }
24 return cmd_results_new(CMD_SUCCESS, NULL); 24 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c
index 2e3f79b4..4456d724 100644
--- a/sway/commands/bar/position.c
+++ b/sway/commands/bar/position.c
@@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
15 char *valid[] = { "top", "bottom" }; 15 char *valid[] = { "top", "bottom" };
16 for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) { 16 for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) {
17 if (strcasecmp(valid[i], argv[0]) == 0) { 17 if (strcasecmp(valid[i], argv[0]) == 0) {
18 wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s", 18 sway_log(SWAY_DEBUG, "Setting bar position '%s' for bar: %s",
19 argv[0], config->current_bar->id); 19 argv[0], config->current_bar->id);
20 free(config->current_bar->position); 20 free(config->current_bar->position);
21 config->current_bar->position = strdup(argv[0]); 21 config->current_bar->position = strdup(argv[0]);
diff --git a/sway/commands/bar/separator_symbol.c b/sway/commands/bar/separator_symbol.c
index 145cdea5..76e99b49 100644
--- a/sway/commands/bar/separator_symbol.c
+++ b/sway/commands/bar/separator_symbol.c
@@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_separator_symbol(int argc, char **argv) {
13 } 13 }
14 free(config->current_bar->separator_symbol); 14 free(config->current_bar->separator_symbol);
15 config->current_bar->separator_symbol = strdup(argv[0]); 15 config->current_bar->separator_symbol = strdup(argv[0]);
16 wlr_log(WLR_DEBUG, "Settings separator_symbol '%s' for bar: %s", 16 sway_log(SWAY_DEBUG, "Settings separator_symbol '%s' for bar: %s",
17 config->current_bar->separator_symbol, config->current_bar->id); 17 config->current_bar->separator_symbol, config->current_bar->id);
18 return cmd_results_new(CMD_SUCCESS, NULL); 18 return cmd_results_new(CMD_SUCCESS, NULL);
19} 19}
diff --git a/sway/commands/bar/status_command.c b/sway/commands/bar/status_command.c
index c379cc72..0b58e5fa 100644
--- a/sway/commands/bar/status_command.c
+++ b/sway/commands/bar/status_command.c
@@ -17,7 +17,7 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
17 char *new_command = join_args(argv, argc); 17 char *new_command = join_args(argv, argc);
18 if (strcmp(new_command, "-") != 0) { 18 if (strcmp(new_command, "-") != 0) {
19 config->current_bar->status_command = new_command; 19 config->current_bar->status_command = new_command;
20 wlr_log(WLR_DEBUG, "Feeding bar with status command: %s", 20 sway_log(SWAY_DEBUG, "Feeding bar with status command: %s",
21 config->current_bar->status_command); 21 config->current_bar->status_command);
22 } else { 22 } else {
23 free(new_command); 23 free(new_command);
diff --git a/sway/commands/bar/status_edge_padding.c b/sway/commands/bar/status_edge_padding.c
index 565ab9a9..75ef86f0 100644
--- a/sway/commands/bar/status_edge_padding.c
+++ b/sway/commands/bar/status_edge_padding.c
@@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_edge_padding(int argc, char **argv) {
15 "Padding must be a positive integer"); 15 "Padding must be a positive integer");
16 } 16 }
17 config->current_bar->status_edge_padding = padding; 17 config->current_bar->status_edge_padding = padding;
18 wlr_log(WLR_DEBUG, "Status edge padding on bar %s: %d", 18 sway_log(SWAY_DEBUG, "Status edge padding on bar %s: %d",
19 config->current_bar->id, config->current_bar->status_edge_padding); 19 config->current_bar->id, config->current_bar->status_edge_padding);
20 return cmd_results_new(CMD_SUCCESS, NULL); 20 return cmd_results_new(CMD_SUCCESS, NULL);
21} 21}
diff --git a/sway/commands/bar/status_padding.c b/sway/commands/bar/status_padding.c
index 7a69a25d..0c65e516 100644
--- a/sway/commands/bar/status_padding.c
+++ b/sway/commands/bar/status_padding.c
@@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_padding(int argc, char **argv) {
15 "Padding must be a positive integer"); 15 "Padding must be a positive integer");
16 } 16 }
17 config->current_bar->status_padding = padding; 17 config->current_bar->status_padding = padding;
18 wlr_log(WLR_DEBUG, "Status padding on bar %s: %d", 18 sway_log(SWAY_DEBUG, "Status padding on bar %s: %d",
19 config->current_bar->id, config->current_bar->status_padding); 19 config->current_bar->id, config->current_bar->status_padding);
20 return cmd_results_new(CMD_SUCCESS, NULL); 20 return cmd_results_new(CMD_SUCCESS, NULL);
21} 21}
diff --git a/sway/commands/bar/strip_workspace_name.c b/sway/commands/bar/strip_workspace_name.c
index b74afd6e..1aa39359 100644
--- a/sway/commands/bar/strip_workspace_name.c
+++ b/sway/commands/bar/strip_workspace_name.c
@@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_name(int argc, char **argv) {
20 if (config->current_bar->strip_workspace_name) { 20 if (config->current_bar->strip_workspace_name) {
21 config->current_bar->strip_workspace_numbers = false; 21 config->current_bar->strip_workspace_numbers = false;
22 22
23 wlr_log(WLR_DEBUG, "Stripping workspace name on bar: %s", 23 sway_log(SWAY_DEBUG, "Stripping workspace name on bar: %s",
24 config->current_bar->id); 24 config->current_bar->id);
25 } else { 25 } else {
26 wlr_log(WLR_DEBUG, "Enabling workspace name on bar: %s", 26 sway_log(SWAY_DEBUG, "Enabling workspace name on bar: %s",
27 config->current_bar->id); 27 config->current_bar->id);
28 } 28 }
29 29
diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/commands/bar/strip_workspace_numbers.c
index 9c6ec228..56c4c4a1 100644
--- a/sway/commands/bar/strip_workspace_numbers.c
+++ b/sway/commands/bar/strip_workspace_numbers.c
@@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
20 if (config->current_bar->strip_workspace_numbers) { 20 if (config->current_bar->strip_workspace_numbers) {
21 config->current_bar->strip_workspace_name = false; 21 config->current_bar->strip_workspace_name = false;
22 22
23 wlr_log(WLR_DEBUG, "Stripping workspace numbers on bar: %s", 23 sway_log(SWAY_DEBUG, "Stripping workspace numbers on bar: %s",
24 config->current_bar->id); 24 config->current_bar->id);
25 } else { 25 } else {
26 wlr_log(WLR_DEBUG, "Enabling workspace numbers on bar: %s", 26 sway_log(SWAY_DEBUG, "Enabling workspace numbers on bar: %s",
27 config->current_bar->id); 27 config->current_bar->id);
28 } 28 }
29 29
diff --git a/sway/commands/bar/swaybar_command.c b/sway/commands/bar/swaybar_command.c
index 6253e2b1..b54bafa9 100644
--- a/sway/commands/bar/swaybar_command.c
+++ b/sway/commands/bar/swaybar_command.c
@@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
13 } 13 }
14 free(config->current_bar->swaybar_command); 14 free(config->current_bar->swaybar_command);
15 config->current_bar->swaybar_command = join_args(argv, argc); 15 config->current_bar->swaybar_command = join_args(argv, argc);
16 wlr_log(WLR_DEBUG, "Using custom swaybar command: %s", 16 sway_log(SWAY_DEBUG, "Using custom swaybar command: %s",
17 config->current_bar->swaybar_command); 17 config->current_bar->swaybar_command);
18 return cmd_results_new(CMD_SUCCESS, NULL); 18 return cmd_results_new(CMD_SUCCESS, NULL);
19} 19}
diff --git a/sway/commands/bar/tray_bind.c b/sway/commands/bar/tray_bind.c
index 48a15462..7fe67c42 100644
--- a/sway/commands/bar/tray_bind.c
+++ b/sway/commands/bar/tray_bind.c
@@ -67,7 +67,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
67 other->command = binding->command; 67 other->command = binding->command;
68 free(binding); 68 free(binding);
69 binding = other; 69 binding = other;
70 wlr_log(WLR_DEBUG, 70 sway_log(SWAY_DEBUG,
71 "[bar %s] Updated tray binding for %u (%s) to %s", 71 "[bar %s] Updated tray binding for %u (%s) to %s",
72 config->current_bar->id, binding->button, name, 72 config->current_bar->id, binding->button, name,
73 binding->command); 73 binding->command);
@@ -76,7 +76,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
76 } 76 }
77 if (!overwritten) { 77 if (!overwritten) {
78 wl_list_insert(&config->current_bar->tray_bindings, &binding->link); 78 wl_list_insert(&config->current_bar->tray_bindings, &binding->link);
79 wlr_log(WLR_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s", 79 sway_log(SWAY_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s",
80 config->current_bar->id, binding->button, name, 80 config->current_bar->id, binding->button, name,
81 binding->command); 81 binding->command);
82 } 82 }
diff --git a/sway/commands/bar/tray_output.c b/sway/commands/bar/tray_output.c
index d45c09c6..16e16f60 100644
--- a/sway/commands/bar/tray_output.c
+++ b/sway/commands/bar/tray_output.c
@@ -23,13 +23,13 @@ struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
23 } 23 }
24 24
25 if (strcmp(argv[0], "none") == 0) { 25 if (strcmp(argv[0], "none") == 0) {
26 wlr_log(WLR_DEBUG, "Hiding tray on bar: %s", config->current_bar->id); 26 sway_log(SWAY_DEBUG, "Hiding tray on bar: %s", config->current_bar->id);
27 for (int i = 0; i < outputs->length; ++i) { 27 for (int i = 0; i < outputs->length; ++i) {
28 free(outputs->items[i]); 28 free(outputs->items[i]);
29 } 29 }
30 outputs->length = 0; 30 outputs->length = 0;
31 } else { 31 } else {
32 wlr_log(WLR_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0], 32 sway_log(SWAY_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0],
33 config->current_bar->id); 33 config->current_bar->id);
34 } 34 }
35 list_add(outputs, strdup(argv[0])); 35 list_add(outputs, strdup(argv[0]));
diff --git a/sway/commands/bar/tray_padding.c b/sway/commands/bar/tray_padding.c
index 1e8b294b..f43cfe4f 100644
--- a/sway/commands/bar/tray_padding.c
+++ b/sway/commands/bar/tray_padding.c
@@ -32,7 +32,7 @@ struct cmd_results *bar_cmd_tray_padding(int argc, char **argv) {
32 "Expected 'tray_padding <px> [px]'"); 32 "Expected 'tray_padding <px> [px]'");
33 } 33 }
34 34
35 wlr_log(WLR_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding); 35 sway_log(SWAY_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding);
36 config->current_bar->tray_padding = padding; 36 config->current_bar->tray_padding = padding;
37 return cmd_results_new(CMD_SUCCESS, NULL); 37 return cmd_results_new(CMD_SUCCESS, NULL);
38#else 38#else
diff --git a/sway/commands/bar/workspace_buttons.c b/sway/commands/bar/workspace_buttons.c
index 773e6357..792ef605 100644
--- a/sway/commands/bar/workspace_buttons.c
+++ b/sway/commands/bar/workspace_buttons.c
@@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) {
15 config->current_bar->workspace_buttons = 15 config->current_bar->workspace_buttons =
16 parse_boolean(argv[0], config->current_bar->workspace_buttons); 16 parse_boolean(argv[0], config->current_bar->workspace_buttons);
17 if (config->current_bar->workspace_buttons) { 17 if (config->current_bar->workspace_buttons) {
18 wlr_log(WLR_DEBUG, "Enabling workspace buttons on bar: %s", 18 sway_log(SWAY_DEBUG, "Enabling workspace buttons on bar: %s",
19 config->current_bar->id); 19 config->current_bar->id);
20 } else { 20 } else {
21 wlr_log(WLR_DEBUG, "Disabling workspace buttons on bar: %s", 21 sway_log(SWAY_DEBUG, "Disabling workspace buttons on bar: %s",
22 config->current_bar->id); 22 config->current_bar->id);
23 } 23 }
24 return cmd_results_new(CMD_SUCCESS, NULL); 24 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c
index 2f7bb090..decd238d 100644
--- a/sway/commands/bar/wrap_scroll.c
+++ b/sway/commands/bar/wrap_scroll.c
@@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) {
15 config->current_bar->wrap_scroll = 15 config->current_bar->wrap_scroll =
16 parse_boolean(argv[0], config->current_bar->wrap_scroll); 16 parse_boolean(argv[0], config->current_bar->wrap_scroll);
17 if (config->current_bar->wrap_scroll) { 17 if (config->current_bar->wrap_scroll) {
18 wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s", 18 sway_log(SWAY_DEBUG, "Enabling wrap scroll on bar: %s",
19 config->current_bar->id); 19 config->current_bar->id);
20 } else { 20 } else {
21 wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s", 21 sway_log(SWAY_DEBUG, "Disabling wrap scroll on bar: %s",
22 config->current_bar->id); 22 config->current_bar->id);
23 } 23 }
24 return cmd_results_new(CMD_SUCCESS, NULL); 24 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index b0493f7e..ce087fd0 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -291,7 +291,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
291 for (int i = 0; i < mode_bindings->length; ++i) { 291 for (int i = 0; i < mode_bindings->length; ++i) {
292 struct sway_binding *config_binding = mode_bindings->items[i]; 292 struct sway_binding *config_binding = mode_bindings->items[i];
293 if (binding_key_compare(binding, config_binding)) { 293 if (binding_key_compare(binding, config_binding)) {
294 wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' " 294 sway_log(SWAY_INFO, "Overwriting binding '%s' for device '%s' "
295 "from `%s` to `%s`", argv[0], binding->input, 295 "from `%s` to `%s`", argv[0], binding->input,
296 binding->command, config_binding->command); 296 binding->command, config_binding->command);
297 if (warn) { 297 if (warn) {
@@ -310,7 +310,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
310 list_add(mode_bindings, binding); 310 list_add(mode_bindings, binding);
311 } 311 }
312 312
313 wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'", 313 sway_log(SWAY_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
314 bindtype, argv[0], binding->command, binding->input); 314 bindtype, argv[0], binding->command, binding->input);
315 return cmd_results_new(CMD_SUCCESS, NULL); 315 return cmd_results_new(CMD_SUCCESS, NULL);
316} 316}
@@ -327,14 +327,14 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
327 * Execute the command associated to a binding 327 * Execute the command associated to a binding
328 */ 328 */
329void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) { 329void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) {
330 wlr_log(WLR_DEBUG, "running command for binding: %s", binding->command); 330 sway_log(SWAY_DEBUG, "running command for binding: %s", binding->command);
331 331
332 list_t *res_list = execute_command(binding->command, seat, NULL); 332 list_t *res_list = execute_command(binding->command, seat, NULL);
333 bool success = true; 333 bool success = true;
334 for (int i = 0; i < res_list->length; ++i) { 334 for (int i = 0; i < res_list->length; ++i) {
335 struct cmd_results *results = res_list->items[i]; 335 struct cmd_results *results = res_list->items[i];
336 if (results->status != CMD_SUCCESS) { 336 if (results->status != CMD_SUCCESS) {
337 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", 337 sway_log(SWAY_DEBUG, "could not run command for binding: %s (%s)",
338 binding->command, results->error); 338 binding->command, results->error);
339 success = false; 339 success = false;
340 } 340 }
diff --git a/sway/commands/client.c b/sway/commands/client.c
index 10bfa519..f5c7d90f 100644
--- a/sway/commands/client.c
+++ b/sway/commands/client.c
@@ -114,6 +114,6 @@ struct cmd_results *cmd_client_urgent(int argc, char **argv) {
114} 114}
115 115
116struct cmd_results *cmd_client_noop(int argc, char **argv) { 116struct cmd_results *cmd_client_noop(int argc, char **argv) {
117 wlr_log(WLR_INFO, "Warning: %s is ignored by sway", argv[-1]); 117 sway_log(SWAY_INFO, "Warning: %s is ignored by sway", argv[-1]);
118 return cmd_results_new(CMD_SUCCESS, NULL); 118 return cmd_results_new(CMD_SUCCESS, NULL);
119} 119}
diff --git a/sway/commands/exec.c b/sway/commands/exec.c
index dc8d8aac..87d90716 100644
--- a/sway/commands/exec.c
+++ b/sway/commands/exec.c
@@ -8,7 +8,7 @@ struct cmd_results *cmd_exec(int argc, char **argv) {
8 if (!config->active) return cmd_results_new(CMD_DEFER, NULL); 8 if (!config->active) return cmd_results_new(CMD_DEFER, NULL);
9 if (config->reloading) { 9 if (config->reloading) {
10 char *args = join_args(argv, argc); 10 char *args = join_args(argv, argc);
11 wlr_log(WLR_DEBUG, "Ignoring 'exec %s' due to reload", args); 11 sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args);
12 free(args); 12 free(args);
13 return cmd_results_new(CMD_SUCCESS, NULL); 13 return cmd_results_new(CMD_SUCCESS, NULL);
14 } 14 }
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 1ed6c7e6..a5724295 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -24,7 +24,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
24 24
25 char *tmp = NULL; 25 char *tmp = NULL;
26 if (strcmp(argv[0], "--no-startup-id") == 0) { 26 if (strcmp(argv[0], "--no-startup-id") == 0) {
27 wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored."); 27 sway_log(SWAY_INFO, "exec switch '--no-startup-id' not supported, ignored.");
28 --argc; ++argv; 28 --argc; ++argv;
29 if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) { 29 if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
30 return error; 30 return error;
@@ -43,11 +43,11 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
43 strncpy(cmd, tmp, sizeof(cmd) - 1); 43 strncpy(cmd, tmp, sizeof(cmd) - 1);
44 cmd[sizeof(cmd) - 1] = 0; 44 cmd[sizeof(cmd) - 1] = 0;
45 free(tmp); 45 free(tmp);
46 wlr_log(WLR_DEBUG, "Executing %s", cmd); 46 sway_log(SWAY_DEBUG, "Executing %s", cmd);
47 47
48 int fd[2]; 48 int fd[2];
49 if (pipe(fd) != 0) { 49 if (pipe(fd) != 0) {
50 wlr_log(WLR_ERROR, "Unable to create pipe for fork"); 50 sway_log(SWAY_ERROR, "Unable to create pipe for fork");
51 } 51 }
52 52
53 pid_t pid, child; 53 pid_t pid, child;
@@ -84,7 +84,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
84 // cleanup child process 84 // cleanup child process
85 waitpid(pid, NULL, 0); 85 waitpid(pid, NULL, 0);
86 if (child > 0) { 86 if (child > 0) {
87 wlr_log(WLR_DEBUG, "Child process created with pid %d", child); 87 sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
88 root_record_workspace_pid(child); 88 root_record_workspace_pid(child);
89 } else { 89 } else {
90 return cmd_results_new(CMD_FAILURE, "Second fork() failed"); 90 return cmd_results_new(CMD_FAILURE, "Second fork() failed");
diff --git a/sway/commands/floating_minmax_size.c b/sway/commands/floating_minmax_size.c
index 31c1e999..3a1d606a 100644
--- a/sway/commands/floating_minmax_size.c
+++ b/sway/commands/floating_minmax_size.c
@@ -4,7 +4,6 @@
4#include <stdlib.h> 4#include <stdlib.h>
5#include <string.h> 5#include <string.h>
6#include <strings.h> 6#include <strings.h>
7#include <wlr/util/log.h>
8#include "sway/commands.h" 7#include "sway/commands.h"
9#include "log.h" 8#include "log.h"
10 9
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 8564f3ff..e7680062 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -1,6 +1,5 @@
1#include <strings.h> 1#include <strings.h>
2#include <wlr/types/wlr_output_layout.h> 2#include <wlr/types/wlr_output_layout.h>
3#include <wlr/util/log.h>
4#include "log.h" 3#include "log.h"
5#include "sway/commands.h" 4#include "sway/commands.h"
6#include "sway/input/input-manager.h" 5#include "sway/input/input-manager.h"
diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c
index f151575e..63cba099 100644
--- a/sway/commands/for_window.c
+++ b/sway/commands/for_window.c
@@ -23,7 +23,7 @@ struct cmd_results *cmd_for_window(int argc, char **argv) {
23 criteria->cmdlist = join_args(argv + 1, argc - 1); 23 criteria->cmdlist = join_args(argv + 1, argc - 1);
24 24
25 list_add(config->criteria, criteria); 25 list_add(config->criteria, criteria);
26 wlr_log(WLR_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist); 26 sway_log(SWAY_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);
27 27
28 return cmd_results_new(CMD_SUCCESS, NULL); 28 return cmd_results_new(CMD_SUCCESS, NULL);
29} 29}
diff --git a/sway/commands/input.c b/sway/commands/input.c
index 1f77507a..b72bd76b 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -45,7 +45,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
45 return error; 45 return error;
46 } 46 }
47 47
48 wlr_log(WLR_DEBUG, "entering input block: %s", argv[0]); 48 sway_log(SWAY_DEBUG, "entering input block: %s", argv[0]);
49 49
50 config->handler_context.input_config = new_input_config(argv[0]); 50 config->handler_context.input_config = new_input_config(argv[0]);
51 if (!config->handler_context.input_config) { 51 if (!config->handler_context.input_config) {
diff --git a/sway/commands/input/xkb_layout.c b/sway/commands/input/xkb_layout.c
index c9200aa2..0879e2da 100644
--- a/sway/commands/input/xkb_layout.c
+++ b/sway/commands/input/xkb_layout.c
@@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
16 16
17 ic->xkb_layout = strdup(argv[0]); 17 ic->xkb_layout = strdup(argv[0]);
18 18
19 wlr_log(WLR_DEBUG, "set-xkb_layout for config: %s layout: %s", 19 sway_log(SWAY_DEBUG, "set-xkb_layout for config: %s layout: %s",
20 ic->identifier, ic->xkb_layout); 20 ic->identifier, ic->xkb_layout);
21 return cmd_results_new(CMD_SUCCESS, NULL); 21 return cmd_results_new(CMD_SUCCESS, NULL);
22} 22}
diff --git a/sway/commands/input/xkb_model.c b/sway/commands/input/xkb_model.c
index 763ae80e..9e384156 100644
--- a/sway/commands/input/xkb_model.c
+++ b/sway/commands/input/xkb_model.c
@@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
16 16
17 ic->xkb_model = strdup(argv[0]); 17 ic->xkb_model = strdup(argv[0]);
18 18
19 wlr_log(WLR_DEBUG, "set-xkb_model for config: %s model: %s", 19 sway_log(SWAY_DEBUG, "set-xkb_model for config: %s model: %s",
20 ic->identifier, ic->xkb_model); 20 ic->identifier, ic->xkb_model);
21 return cmd_results_new(CMD_SUCCESS, NULL); 21 return cmd_results_new(CMD_SUCCESS, NULL);
22} 22}
diff --git a/sway/commands/input/xkb_options.c b/sway/commands/input/xkb_options.c
index 1ff6e680..8197dd1d 100644
--- a/sway/commands/input/xkb_options.c
+++ b/sway/commands/input/xkb_options.c
@@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
16 16
17 ic->xkb_options = strdup(argv[0]); 17 ic->xkb_options = strdup(argv[0]);
18 18
19 wlr_log(WLR_DEBUG, "set-xkb_options for config: %s options: %s", 19 sway_log(SWAY_DEBUG, "set-xkb_options for config: %s options: %s",
20 ic->identifier, ic->xkb_options); 20 ic->identifier, ic->xkb_options);
21 return cmd_results_new(CMD_SUCCESS, NULL); 21 return cmd_results_new(CMD_SUCCESS, NULL);
22} 22}
diff --git a/sway/commands/input/xkb_rules.c b/sway/commands/input/xkb_rules.c
index 29172b24..01ccd06f 100644
--- a/sway/commands/input/xkb_rules.c
+++ b/sway/commands/input/xkb_rules.c
@@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
16 16
17 ic->xkb_rules = strdup(argv[0]); 17 ic->xkb_rules = strdup(argv[0]);
18 18
19 wlr_log(WLR_DEBUG, "set-xkb_rules for config: %s rules: %s", 19 sway_log(SWAY_DEBUG, "set-xkb_rules for config: %s rules: %s",
20 ic->identifier, ic->xkb_rules); 20 ic->identifier, ic->xkb_rules);
21 return cmd_results_new(CMD_SUCCESS, NULL); 21 return cmd_results_new(CMD_SUCCESS, NULL);
22} 22}
diff --git a/sway/commands/input/xkb_variant.c b/sway/commands/input/xkb_variant.c
index 9f3baed6..37c82fbd 100644
--- a/sway/commands/input/xkb_variant.c
+++ b/sway/commands/input/xkb_variant.c
@@ -16,7 +16,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
16 16
17 ic->xkb_variant = strdup(argv[0]); 17 ic->xkb_variant = strdup(argv[0]);
18 18
19 wlr_log(WLR_DEBUG, "set-xkb_variant for config: %s variant: %s", 19 sway_log(SWAY_DEBUG, "set-xkb_variant for config: %s variant: %s",
20 ic->identifier, ic->xkb_variant); 20 ic->identifier, ic->xkb_variant);
21 return cmd_results_new(CMD_SUCCESS, NULL); 21 return cmd_results_new(CMD_SUCCESS, NULL);
22} 22}
diff --git a/sway/commands/kill.c b/sway/commands/kill.c
index 41daeb4e..f1e95e4b 100644
--- a/sway/commands/kill.c
+++ b/sway/commands/kill.c
@@ -1,4 +1,3 @@
1#include <wlr/util/log.h>
2#include "log.h" 1#include "log.h"
3#include "sway/input/input-manager.h" 2#include "sway/input/input-manager.h"
4#include "sway/input/seat.h" 3#include "sway/input/seat.h"
diff --git a/sway/commands/mode.c b/sway/commands/mode.c
index 828d77e1..d424eb1c 100644
--- a/sway/commands/mode.c
+++ b/sway/commands/mode.c
@@ -62,7 +62,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) {
62 return error; 62 return error;
63 } 63 }
64 if ((config->reading && argc > 1) || (!config->reading && argc == 1)) { 64 if ((config->reading && argc > 1) || (!config->reading && argc == 1)) {
65 wlr_log(WLR_DEBUG, "Switching to mode `%s' (pango=%d)", 65 sway_log(SWAY_DEBUG, "Switching to mode `%s' (pango=%d)",
66 mode->name, mode->pango); 66 mode->name, mode->pango);
67 } 67 }
68 // Set current mode 68 // Set current mode
diff --git a/sway/commands/move.c b/sway/commands/move.c
index d4b55922..b22bb056 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -6,7 +6,6 @@
6#include <wlr/types/wlr_cursor.h> 6#include <wlr/types/wlr_cursor.h>
7#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
8#include <wlr/types/wlr_output_layout.h> 8#include <wlr/types/wlr_output_layout.h>
9#include <wlr/util/log.h>
10#include "sway/commands.h" 9#include "sway/commands.h"
11#include "sway/input/cursor.h" 10#include "sway/input/cursor.h"
12#include "sway/input/seat.h" 11#include "sway/input/seat.h"
@@ -106,13 +105,13 @@ static void container_move_to_container_from_direction(
106 if (destination->view) { 105 if (destination->view) {
107 if (destination->parent == container->parent && 106 if (destination->parent == container->parent &&
108 destination->workspace == container->workspace) { 107 destination->workspace == container->workspace) {
109 wlr_log(WLR_DEBUG, "Swapping siblings"); 108 sway_log(SWAY_DEBUG, "Swapping siblings");
110 list_t *siblings = container_get_siblings(container); 109 list_t *siblings = container_get_siblings(container);
111 int container_index = list_find(siblings, container); 110 int container_index = list_find(siblings, container);
112 int destination_index = list_find(siblings, destination); 111 int destination_index = list_find(siblings, destination);
113 list_swap(siblings, container_index, destination_index); 112 list_swap(siblings, container_index, destination_index);
114 } else { 113 } else {
115 wlr_log(WLR_DEBUG, "Promoting to sibling of cousin"); 114 sway_log(SWAY_DEBUG, "Promoting to sibling of cousin");
116 int offset = 115 int offset =
117 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP; 116 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP;
118 int index = container_sibling_index(destination) + offset; 117 int index = container_sibling_index(destination) + offset;
@@ -128,7 +127,7 @@ static void container_move_to_container_from_direction(
128 } 127 }
129 128
130 if (is_parallel(destination->layout, move_dir)) { 129 if (is_parallel(destination->layout, move_dir)) {
131 wlr_log(WLR_DEBUG, "Reparenting container (parallel)"); 130 sway_log(SWAY_DEBUG, "Reparenting container (parallel)");
132 int index = 131 int index =
133 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ? 132 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ?
134 0 : destination->children->length; 133 0 : destination->children->length;
@@ -137,7 +136,7 @@ static void container_move_to_container_from_direction(
137 return; 136 return;
138 } 137 }
139 138
140 wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)"); 139 sway_log(SWAY_DEBUG, "Reparenting container (perpendicular)");
141 struct sway_node *focus_inactive = seat_get_active_tiling_child( 140 struct sway_node *focus_inactive = seat_get_active_tiling_child(
142 config->handler_context.seat, &destination->node); 141 config->handler_context.seat, &destination->node);
143 if (!focus_inactive || focus_inactive == &destination->node) { 142 if (!focus_inactive || focus_inactive == &destination->node) {
@@ -157,7 +156,7 @@ static void container_move_to_workspace_from_direction(
157 container->width = container->height = 0; 156 container->width = container->height = 0;
158 157
159 if (is_parallel(workspace->layout, move_dir)) { 158 if (is_parallel(workspace->layout, move_dir)) {
160 wlr_log(WLR_DEBUG, "Reparenting container (parallel)"); 159 sway_log(SWAY_DEBUG, "Reparenting container (parallel)");
161 int index = 160 int index =
162 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ? 161 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ?
163 0 : workspace->tiling->length; 162 0 : workspace->tiling->length;
@@ -165,7 +164,7 @@ static void container_move_to_workspace_from_direction(
165 return; 164 return;
166 } 165 }
167 166
168 wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)"); 167 sway_log(SWAY_DEBUG, "Reparenting container (perpendicular)");
169 struct sway_container *focus_inactive = seat_get_focus_inactive_tiling( 168 struct sway_container *focus_inactive = seat_get_focus_inactive_tiling(
170 config->handler_context.seat, workspace); 169 config->handler_context.seat, workspace);
171 if (!focus_inactive) { 170 if (!focus_inactive) {
@@ -362,7 +361,7 @@ static bool container_move_in_direction(struct sway_container *container,
362 container_move_to_workspace_from_direction(container, ws, move_dir); 361 container_move_to_workspace_from_direction(container, ws, move_dir);
363 return true; 362 return true;
364 } 363 }
365 wlr_log(WLR_DEBUG, "Hit edge of output, nowhere else to go"); 364 sway_log(SWAY_DEBUG, "Hit edge of output, nowhere else to go");
366 return false; 365 return false;
367} 366}
368 367
diff --git a/sway/commands/output.c b/sway/commands/output.c
index 73dbb723..74ca9d0b 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -28,7 +28,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
28 28
29 struct output_config *output = new_output_config(argv[0]); 29 struct output_config *output = new_output_config(argv[0]);
30 if (!output) { 30 if (!output) {
31 wlr_log(WLR_ERROR, "Failed to allocate output config"); 31 sway_log(SWAY_ERROR, "Failed to allocate output config");
32 return NULL; 32 return NULL;
33 } 33 }
34 argc--; argv++; 34 argc--; argv++;
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c
index 00038e67..affa04ea 100644
--- a/sway/commands/output/background.c
+++ b/sway/commands/output/background.c
@@ -79,7 +79,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
79 src = join_args(p.we_wordv, p.we_wordc); 79 src = join_args(p.we_wordv, p.we_wordc);
80 wordfree(&p); 80 wordfree(&p);
81 if (!src) { 81 if (!src) {
82 wlr_log(WLR_ERROR, "Failed to duplicate string"); 82 sway_log(SWAY_ERROR, "Failed to duplicate string");
83 return cmd_results_new(CMD_FAILURE, "Unable to allocate resource"); 83 return cmd_results_new(CMD_FAILURE, "Unable to allocate resource");
84 } 84 }
85 85
@@ -88,7 +88,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
88 88
89 char *conf = strdup(config->current_config_path); 89 char *conf = strdup(config->current_config_path);
90 if (!conf) { 90 if (!conf) {
91 wlr_log(WLR_ERROR, "Failed to duplicate string"); 91 sway_log(SWAY_ERROR, "Failed to duplicate string");
92 free(src); 92 free(src);
93 return cmd_results_new(CMD_FAILURE, 93 return cmd_results_new(CMD_FAILURE,
94 "Unable to allocate resources"); 94 "Unable to allocate resources");
@@ -100,7 +100,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
100 if (!src) { 100 if (!src) {
101 free(rel_path); 101 free(rel_path);
102 free(conf); 102 free(conf);
103 wlr_log(WLR_ERROR, "Unable to allocate memory"); 103 sway_log(SWAY_ERROR, "Unable to allocate memory");
104 return cmd_results_new(CMD_FAILURE, 104 return cmd_results_new(CMD_FAILURE,
105 "Unable to allocate resources"); 105 "Unable to allocate resources");
106 } 106 }
@@ -112,7 +112,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
112 112
113 bool can_access = access(src, F_OK) != -1; 113 bool can_access = access(src, F_OK) != -1;
114 if (!can_access) { 114 if (!can_access) {
115 wlr_log(WLR_ERROR, "Unable to access background file '%s': %s", 115 sway_log(SWAY_ERROR, "Unable to access background file '%s': %s",
116 src, strerror(errno)); 116 src, strerror(errno));
117 config_add_swaynag_warning("Unable to access background file '%s'", 117 config_add_swaynag_warning("Unable to access background file '%s'",
118 src); 118 src);
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
index 6e7772e9..19ec065c 100644
--- a/sway/commands/reload.c
+++ b/sway/commands/reload.c
@@ -23,7 +23,7 @@ static void do_reload(void *data) {
23 } 23 }
24 24
25 if (!load_main_config(config->current_config_path, true, false)) { 25 if (!load_main_config(config->current_config_path, true, false)) {
26 wlr_log(WLR_ERROR, "Error(s) reloading config"); 26 sway_log(SWAY_ERROR, "Error(s) reloading config");
27 list_free_items_and_destroy(bar_ids); 27 list_free_items_and_destroy(bar_ids);
28 return; 28 return;
29 } 29 }
diff --git a/sway/commands/rename.c b/sway/commands/rename.c
index a68302c4..88377b09 100644
--- a/sway/commands/rename.c
+++ b/sway/commands/rename.c
@@ -88,7 +88,7 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
88 } 88 }
89 } 89 }
90 90
91 wlr_log(WLR_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name); 91 sway_log(SWAY_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);
92 free(workspace->name); 92 free(workspace->name);
93 workspace->name = new_name; 93 workspace->name = new_name;
94 94
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index c88d2734..0e497239 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -6,7 +6,6 @@
6#include <string.h> 6#include <string.h>
7#include <strings.h> 7#include <strings.h>
8#include <wlr/util/edges.h> 8#include <wlr/util/edges.h>
9#include <wlr/util/log.h>
10#include "sway/commands.h" 9#include "sway/commands.h"
11#include "sway/tree/arrange.h" 10#include "sway/tree/arrange.h"
12#include "sway/tree/view.h" 11#include "sway/tree/view.h"
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index 1162d51f..805dbc0b 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -23,7 +23,7 @@ static void scratchpad_toggle_auto(void) {
23 // Check if the currently focused window is a scratchpad window and should 23 // Check if the currently focused window is a scratchpad window and should
24 // be hidden again. 24 // be hidden again.
25 if (focus && focus->scratchpad) { 25 if (focus && focus->scratchpad) {
26 wlr_log(WLR_DEBUG, "Focus is a scratchpad window - hiding %s", 26 sway_log(SWAY_DEBUG, "Focus is a scratchpad window - hiding %s",
27 focus->title); 27 focus->title);
28 root_scratchpad_hide(focus); 28 root_scratchpad_hide(focus);
29 return; 29 return;
@@ -34,7 +34,7 @@ static void scratchpad_toggle_auto(void) {
34 for (int i = 0; i < ws->floating->length; ++i) { 34 for (int i = 0; i < ws->floating->length; ++i) {
35 struct sway_container *floater = ws->floating->items[i]; 35 struct sway_container *floater = ws->floating->items[i];
36 if (floater->scratchpad && focus != floater) { 36 if (floater->scratchpad && focus != floater) {
37 wlr_log(WLR_DEBUG, 37 sway_log(SWAY_DEBUG,
38 "Focusing other scratchpad window (%s) in this workspace", 38 "Focusing other scratchpad window (%s) in this workspace",
39 floater->title); 39 floater->title);
40 root_scratchpad_show(floater); 40 root_scratchpad_show(floater);
@@ -47,7 +47,7 @@ static void scratchpad_toggle_auto(void) {
47 for (int i = 0; i < root->scratchpad->length; ++i) { 47 for (int i = 0; i < root->scratchpad->length; ++i) {
48 struct sway_container *con = root->scratchpad->items[i]; 48 struct sway_container *con = root->scratchpad->items[i];
49 if (con->parent) { 49 if (con->parent) {
50 wlr_log(WLR_DEBUG, 50 sway_log(SWAY_DEBUG,
51 "Moving a visible scratchpad window (%s) to this workspace", 51 "Moving a visible scratchpad window (%s) to this workspace",
52 con->title); 52 con->title);
53 root_scratchpad_show(con); 53 root_scratchpad_show(con);
@@ -60,7 +60,7 @@ static void scratchpad_toggle_auto(void) {
60 return; 60 return;
61 } 61 }
62 struct sway_container *con = root->scratchpad->items[0]; 62 struct sway_container *con = root->scratchpad->items[0];
63 wlr_log(WLR_DEBUG, "Showing %s from list", con->title); 63 sway_log(SWAY_DEBUG, "Showing %s from list", con->title);
64 root_scratchpad_show(con); 64 root_scratchpad_show(con);
65} 65}
66 66
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index a8beb162..0d8d1116 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -1,6 +1,5 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <strings.h> 2#include <strings.h>
3#include <wlr/util/log.h>
4#include "config.h" 3#include "config.h"
5#include "log.h" 4#include "log.h"
6#include "sway/commands.h" 5#include "sway/commands.h"
@@ -96,7 +95,7 @@ static void container_swap(struct sway_container *con1,
96 return; 95 return;
97 } 96 }
98 97
99 wlr_log(WLR_DEBUG, "Swapping containers %zu and %zu", 98 sway_log(SWAY_DEBUG, "Swapping containers %zu and %zu",
100 con1->node.id, con2->node.id); 99 con1->node.id, con2->node.id);
101 100
102 bool fs1 = con1->is_fullscreen; 101 bool fs1 = con1->is_fullscreen;
diff --git a/sway/commands/swaybg_command.c b/sway/commands/swaybg_command.c
index 91294bf4..92e9bdfd 100644
--- a/sway/commands/swaybg_command.c
+++ b/sway/commands/swaybg_command.c
@@ -15,7 +15,7 @@ struct cmd_results *cmd_swaybg_command(int argc, char **argv) {
15 char *new_command = join_args(argv, argc); 15 char *new_command = join_args(argv, argc);
16 if (strcmp(new_command, "-") != 0) { 16 if (strcmp(new_command, "-") != 0) {
17 config->swaybg_command = new_command; 17 config->swaybg_command = new_command;
18 wlr_log(WLR_DEBUG, "Using custom swaybg command: %s", 18 sway_log(SWAY_DEBUG, "Using custom swaybg command: %s",
19 config->swaybg_command); 19 config->swaybg_command);
20 } else { 20 } else {
21 free(new_command); 21 free(new_command);
diff --git a/sway/commands/swaynag_command.c b/sway/commands/swaynag_command.c
index b420f311..f851d223 100644
--- a/sway/commands/swaynag_command.c
+++ b/sway/commands/swaynag_command.c
@@ -15,7 +15,7 @@ struct cmd_results *cmd_swaynag_command(int argc, char **argv) {
15 char *new_command = join_args(argv, argc); 15 char *new_command = join_args(argv, argc);
16 if (strcmp(new_command, "-") != 0) { 16 if (strcmp(new_command, "-") != 0) {
17 config->swaynag_command = new_command; 17 config->swaynag_command = new_command;
18 wlr_log(WLR_DEBUG, "Using custom swaynag command: %s", 18 sway_log(SWAY_DEBUG, "Using custom swaynag command: %s",
19 config->swaynag_command); 19 config->swaynag_command);
20 } else { 20 } else {
21 free(new_command); 21 free(new_command);
diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c
index c3f73f67..b72f3239 100644
--- a/sway/commands/xwayland.c
+++ b/sway/commands/xwayland.c
@@ -13,7 +13,7 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) {
13#ifdef HAVE_XWAYLAND 13#ifdef HAVE_XWAYLAND
14 config->xwayland = parse_boolean(argv[0], config->xwayland); 14 config->xwayland = parse_boolean(argv[0], config->xwayland);
15#else 15#else
16 wlr_log(WLR_INFO, "Ignoring `xwayland` command, " 16 sway_log(SWAY_INFO, "Ignoring `xwayland` command, "
17 "sway hasn't been built with Xwayland support"); 17 "sway hasn't been built with Xwayland support");
18#endif 18#endif
19 19
diff --git a/sway/config.c b/sway/config.c
index d5d36306..145b3be6 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -335,11 +335,11 @@ static char *get_config_path(void) {
335static bool load_config(const char *path, struct sway_config *config, 335static bool load_config(const char *path, struct sway_config *config,
336 struct swaynag_instance *swaynag) { 336 struct swaynag_instance *swaynag) {
337 if (path == NULL) { 337 if (path == NULL) {
338 wlr_log(WLR_ERROR, "Unable to find a config file!"); 338 sway_log(SWAY_ERROR, "Unable to find a config file!");
339 return false; 339 return false;
340 } 340 }
341 341
342 wlr_log(WLR_INFO, "Loading config from %s", path); 342 sway_log(SWAY_INFO, "Loading config from %s", path);
343 343
344 struct stat sb; 344 struct stat sb;
345 if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { 345 if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
@@ -348,7 +348,7 @@ static bool load_config(const char *path, struct sway_config *config,
348 348
349 FILE *f = fopen(path, "r"); 349 FILE *f = fopen(path, "r");
350 if (!f) { 350 if (!f) {
351 wlr_log(WLR_ERROR, "Unable to open %s for reading", path); 351 sway_log(SWAY_ERROR, "Unable to open %s for reading", path);
352 return false; 352 return false;
353 } 353 }
354 354
@@ -356,7 +356,7 @@ static bool load_config(const char *path, struct sway_config *config,
356 fclose(f); 356 fclose(f);
357 357
358 if (!config_load_success) { 358 if (!config_load_success) {
359 wlr_log(WLR_ERROR, "Error(s) loading config!"); 359 sway_log(SWAY_ERROR, "Error(s) loading config!");
360 } 360 }
361 361
362 return true; 362 return true;
@@ -379,7 +379,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
379 config_defaults(config); 379 config_defaults(config);
380 config->validating = validating; 380 config->validating = validating;
381 if (is_active) { 381 if (is_active) {
382 wlr_log(WLR_DEBUG, "Performing configuration file %s", 382 sway_log(SWAY_DEBUG, "Performing configuration file %s",
383 validating ? "validation" : "reload"); 383 validating ? "validation" : "reload");
384 config->reloading = true; 384 config->reloading = true;
385 config->active = true; 385 config->active = true;
@@ -403,7 +403,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
403 /* 403 /*
404 DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); 404 DIR *dir = opendir(SYSCONFDIR "/sway/security.d");
405 if (!dir) { 405 if (!dir) {
406 wlr_log(WLR_ERROR, 406 sway_log(SWAY_ERROR,
407 "%s does not exist, sway will have no security configuration" 407 "%s does not exist, sway will have no security configuration"
408 " and will probably be broken", SYSCONFDIR "/sway/security.d"); 408 " and will probably be broken", SYSCONFDIR "/sway/security.d");
409 } else { 409 } else {
@@ -432,7 +432,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
432 if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || 432 if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 ||
433 (((s.st_mode & 0777) != 0644) && 433 (((s.st_mode & 0777) != 0644) &&
434 (s.st_mode & 0777) != 0444)) { 434 (s.st_mode & 0777) != 0444)) {
435 wlr_log(WLR_ERROR, 435 sway_log(SWAY_ERROR,
436 "Refusing to load %s - it must be owned by root " 436 "Refusing to load %s - it must be owned by root "
437 "and mode 644 or 444", _path); 437 "and mode 644 or 444", _path);
438 success = false; 438 success = false;
@@ -488,7 +488,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
488 len = len + strlen(parent_dir) + 2; 488 len = len + strlen(parent_dir) + 2;
489 full_path = malloc(len * sizeof(char)); 489 full_path = malloc(len * sizeof(char));
490 if (!full_path) { 490 if (!full_path) {
491 wlr_log(WLR_ERROR, 491 sway_log(SWAY_ERROR,
492 "Unable to allocate full path to included config"); 492 "Unable to allocate full path to included config");
493 return false; 493 return false;
494 } 494 }
@@ -501,7 +501,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
501 free(full_path); 501 free(full_path);
502 502
503 if (real_path == NULL) { 503 if (real_path == NULL) {
504 wlr_log(WLR_DEBUG, "%s not found.", path); 504 sway_log(SWAY_DEBUG, "%s not found.", path);
505 return false; 505 return false;
506 } 506 }
507 507
@@ -510,7 +510,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
510 for (j = 0; j < config->config_chain->length; ++j) { 510 for (j = 0; j < config->config_chain->length; ++j) {
511 char *old_path = config->config_chain->items[j]; 511 char *old_path = config->config_chain->items[j];
512 if (strcmp(real_path, old_path) == 0) { 512 if (strcmp(real_path, old_path) == 0) {
513 wlr_log(WLR_DEBUG, 513 sway_log(SWAY_DEBUG,
514 "%s already included once, won't be included again.", 514 "%s already included once, won't be included again.",
515 real_path); 515 real_path);
516 free(real_path); 516 free(real_path);
@@ -565,7 +565,7 @@ bool load_include_configs(const char *path, struct sway_config *config,
565 // restore wd 565 // restore wd
566 if (chdir(wd) < 0) { 566 if (chdir(wd) < 0) {
567 free(wd); 567 free(wd);
568 wlr_log(WLR_ERROR, "failed to restore working directory"); 568 sway_log(SWAY_ERROR, "failed to restore working directory");
569 return false; 569 return false;
570 } 570 }
571 571
@@ -630,7 +630,7 @@ static char *expand_line(const char *block, const char *line, bool add_brace) {
630 + (add_brace ? 2 : 0) + 1; 630 + (add_brace ? 2 : 0) + 1;
631 char *expanded = calloc(1, size); 631 char *expanded = calloc(1, size);
632 if (!expanded) { 632 if (!expanded) {
633 wlr_log(WLR_ERROR, "Cannot allocate expanded line buffer"); 633 sway_log(SWAY_ERROR, "Cannot allocate expanded line buffer");
634 return NULL; 634 return NULL;
635 } 635 }
636 snprintf(expanded, size, "%s%s%s%s", block ? block : "", 636 snprintf(expanded, size, "%s%s%s%s", block ? block : "",
@@ -649,7 +649,7 @@ bool read_config(FILE *file, struct sway_config *config,
649 int ret_seek = fseek(file, 0, SEEK_END); 649 int ret_seek = fseek(file, 0, SEEK_END);
650 long ret_tell = ftell(file); 650 long ret_tell = ftell(file);
651 if (ret_seek == -1 || ret_tell == -1) { 651 if (ret_seek == -1 || ret_tell == -1) {
652 wlr_log(WLR_ERROR, "Unable to get size of config file"); 652 sway_log(SWAY_ERROR, "Unable to get size of config file");
653 return false; 653 return false;
654 } 654 }
655 config_size = ret_tell; 655 config_size = ret_tell;
@@ -657,7 +657,7 @@ bool read_config(FILE *file, struct sway_config *config,
657 657
658 config->current_config = this_config = calloc(1, config_size + 1); 658 config->current_config = this_config = calloc(1, config_size + 1);
659 if (this_config == NULL) { 659 if (this_config == NULL) {
660 wlr_log(WLR_ERROR, "Unable to allocate buffer for config contents"); 660 sway_log(SWAY_ERROR, "Unable to allocate buffer for config contents");
661 return false; 661 return false;
662 } 662 }
663 } 663 }
@@ -673,7 +673,7 @@ bool read_config(FILE *file, struct sway_config *config,
673 while ((nread = getline_with_cont(&line, &line_size, file, &nlines)) != -1) { 673 while ((nread = getline_with_cont(&line, &line_size, file, &nlines)) != -1) {
674 if (reading_main_config) { 674 if (reading_main_config) {
675 if (read + nread > config_size) { 675 if (read + nread > config_size) {
676 wlr_log(WLR_ERROR, "Config file changed during reading"); 676 sway_log(SWAY_ERROR, "Config file changed during reading");
677 success = false; 677 success = false;
678 break; 678 break;
679 } 679 }
@@ -687,7 +687,7 @@ bool read_config(FILE *file, struct sway_config *config,
687 } 687 }
688 688
689 line_number += nlines; 689 line_number += nlines;
690 wlr_log(WLR_DEBUG, "Read line %d: %s", line_number, line); 690 sway_log(SWAY_DEBUG, "Read line %d: %s", line_number, line);
691 691
692 strip_whitespace(line); 692 strip_whitespace(line);
693 if (!*line || line[0] == '#') { 693 if (!*line || line[0] == '#') {
@@ -698,7 +698,7 @@ bool read_config(FILE *file, struct sway_config *config,
698 brace_detected = detect_brace(file); 698 brace_detected = detect_brace(file);
699 if (brace_detected > 0) { 699 if (brace_detected > 0) {
700 line_number += brace_detected; 700 line_number += brace_detected;
701 wlr_log(WLR_DEBUG, "Detected open brace on line %d", line_number); 701 sway_log(SWAY_DEBUG, "Detected open brace on line %d", line_number);
702 } 702 }
703 } 703 }
704 char *block = stack->length ? stack->items[0] : NULL; 704 char *block = stack->length ? stack->items[0] : NULL;
@@ -720,7 +720,7 @@ bool read_config(FILE *file, struct sway_config *config,
720 switch(res->status) { 720 switch(res->status) {
721 case CMD_FAILURE: 721 case CMD_FAILURE:
722 case CMD_INVALID: 722 case CMD_INVALID:
723 wlr_log(WLR_ERROR, "Error on line %i '%s': %s (%s)", line_number, 723 sway_log(SWAY_ERROR, "Error on line %i '%s': %s (%s)", line_number,
724 line, res->error, config->current_config_path); 724 line, res->error, config->current_config_path);
725 if (!config->validating) { 725 if (!config->validating) {
726 swaynag_log(config->swaynag_command, swaynag, 726 swaynag_log(config->swaynag_command, swaynag,
@@ -731,17 +731,17 @@ bool read_config(FILE *file, struct sway_config *config,
731 break; 731 break;
732 732
733 case CMD_DEFER: 733 case CMD_DEFER:
734 wlr_log(WLR_DEBUG, "Deferring command `%s'", line); 734 sway_log(SWAY_DEBUG, "Deferring command `%s'", line);
735 list_add(config->cmd_queue, strdup(expanded)); 735 list_add(config->cmd_queue, strdup(expanded));
736 break; 736 break;
737 737
738 case CMD_BLOCK_COMMANDS: 738 case CMD_BLOCK_COMMANDS:
739 wlr_log(WLR_DEBUG, "Entering commands block"); 739 sway_log(SWAY_DEBUG, "Entering commands block");
740 list_insert(stack, 0, "<commands>"); 740 list_insert(stack, 0, "<commands>");
741 break; 741 break;
742 742
743 case CMD_BLOCK: 743 case CMD_BLOCK:
744 wlr_log(WLR_DEBUG, "Entering block '%s'", new_block); 744 sway_log(SWAY_DEBUG, "Entering block '%s'", new_block);
745 list_insert(stack, 0, strdup(new_block)); 745 list_insert(stack, 0, strdup(new_block));
746 if (strcmp(new_block, "bar") == 0) { 746 if (strcmp(new_block, "bar") == 0) {
747 config->current_bar = NULL; 747 config->current_bar = NULL;
@@ -750,7 +750,7 @@ bool read_config(FILE *file, struct sway_config *config,
750 750
751 case CMD_BLOCK_END: 751 case CMD_BLOCK_END:
752 if (!block) { 752 if (!block) {
753 wlr_log(WLR_DEBUG, "Unmatched '}' on line %i", line_number); 753 sway_log(SWAY_DEBUG, "Unmatched '}' on line %i", line_number);
754 success = false; 754 success = false;
755 break; 755 break;
756 } 756 }
@@ -758,7 +758,7 @@ bool read_config(FILE *file, struct sway_config *config,
758 config->current_bar = NULL; 758 config->current_bar = NULL;
759 } 759 }
760 760
761 wlr_log(WLR_DEBUG, "Exiting block '%s'", block); 761 sway_log(SWAY_DEBUG, "Exiting block '%s'", block);
762 list_del(stack, 0); 762 list_del(stack, 0);
763 free(block); 763 free(block);
764 memset(&config->handler_context, 0, 764 memset(&config->handler_context, 0,
@@ -786,7 +786,7 @@ void config_add_swaynag_warning(char *fmt, ...) {
786 786
787 char *temp = malloc(length + 1); 787 char *temp = malloc(length + 1);
788 if (!temp) { 788 if (!temp) {
789 wlr_log(WLR_ERROR, "Failed to allocate buffer for warning."); 789 sway_log(SWAY_ERROR, "Failed to allocate buffer for warning.");
790 return; 790 return;
791 } 791 }
792 792
@@ -828,7 +828,7 @@ char *do_var_replacement(char *str) {
828 int vvlen = strlen(var->value); 828 int vvlen = strlen(var->value);
829 char *newstr = malloc(strlen(str) - vnlen + vvlen + 1); 829 char *newstr = malloc(strlen(str) - vnlen + vvlen + 1);
830 if (!newstr) { 830 if (!newstr) {
831 wlr_log(WLR_ERROR, 831 sway_log(SWAY_ERROR,
832 "Unable to allocate replacement " 832 "Unable to allocate replacement "
833 "during variable expansion"); 833 "during variable expansion");
834 break; 834 break;
diff --git a/sway/config/bar.c b/sway/config/bar.c
index b1aa2313..0fdac5d8 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -19,10 +19,10 @@
19#include "util.h" 19#include "util.h"
20 20
21static void terminate_swaybar(pid_t pid) { 21static void terminate_swaybar(pid_t pid) {
22 wlr_log(WLR_DEBUG, "Terminating swaybar %d", pid); 22 sway_log(SWAY_DEBUG, "Terminating swaybar %d", pid);
23 int ret = kill(-pid, SIGTERM); 23 int ret = kill(-pid, SIGTERM);
24 if (ret != 0) { 24 if (ret != 0) {
25 wlr_log_errno(WLR_ERROR, "Unable to terminate swaybar %d", pid); 25 sway_log_errno(SWAY_ERROR, "Unable to terminate swaybar %d", pid);
26 } else { 26 } else {
27 int status; 27 int status;
28 waitpid(pid, &status, 0); 28 waitpid(pid, &status, 0);
@@ -194,7 +194,7 @@ static void invoke_swaybar(struct bar_config *bar) {
194 // Pipe to communicate errors 194 // Pipe to communicate errors
195 int filedes[2]; 195 int filedes[2];
196 if (pipe(filedes) == -1) { 196 if (pipe(filedes) == -1) {
197 wlr_log(WLR_ERROR, "Pipe setup failed! Cannot fork into bar"); 197 sway_log(SWAY_ERROR, "Pipe setup failed! Cannot fork into bar");
198 return; 198 return;
199 } 199 }
200 200
@@ -227,17 +227,17 @@ static void invoke_swaybar(struct bar_config *bar) {
227 execvp(cmd[0], cmd); 227 execvp(cmd[0], cmd);
228 exit(1); 228 exit(1);
229 } 229 }
230 wlr_log(WLR_DEBUG, "Spawned swaybar %d", bar->pid); 230 sway_log(SWAY_DEBUG, "Spawned swaybar %d", bar->pid);
231 close(filedes[0]); 231 close(filedes[0]);
232 size_t len; 232 size_t len;
233 if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) { 233 if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) {
234 char *buf = malloc(len); 234 char *buf = malloc(len);
235 if(!buf) { 235 if(!buf) {
236 wlr_log(WLR_ERROR, "Cannot allocate error string"); 236 sway_log(SWAY_ERROR, "Cannot allocate error string");
237 return; 237 return;
238 } 238 }
239 if (read(filedes[1], buf, len)) { 239 if (read(filedes[1], buf, len)) {
240 wlr_log(WLR_ERROR, "%s", buf); 240 sway_log(SWAY_ERROR, "%s", buf);
241 } 241 }
242 free(buf); 242 free(buf);
243 } 243 }
@@ -248,7 +248,7 @@ void load_swaybar(struct bar_config *bar) {
248 if (bar->pid != 0) { 248 if (bar->pid != 0) {
249 terminate_swaybar(bar->pid); 249 terminate_swaybar(bar->pid);
250 } 250 }
251 wlr_log(WLR_DEBUG, "Invoking swaybar for bar id '%s'", bar->id); 251 sway_log(SWAY_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
252 invoke_swaybar(bar); 252 invoke_swaybar(bar);
253} 253}
254 254
diff --git a/sway/config/input.c b/sway/config/input.c
index d649d34d..63c28635 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -8,13 +8,13 @@
8struct input_config *new_input_config(const char* identifier) { 8struct input_config *new_input_config(const char* identifier) {
9 struct input_config *input = calloc(1, sizeof(struct input_config)); 9 struct input_config *input = calloc(1, sizeof(struct input_config));
10 if (!input) { 10 if (!input) {
11 wlr_log(WLR_DEBUG, "Unable to allocate input config"); 11 sway_log(SWAY_DEBUG, "Unable to allocate input config");
12 return NULL; 12 return NULL;
13 } 13 }
14 wlr_log(WLR_DEBUG, "new_input_config(%s)", identifier); 14 sway_log(SWAY_DEBUG, "new_input_config(%s)", identifier);
15 if (!(input->identifier = strdup(identifier))) { 15 if (!(input->identifier = strdup(identifier))) {
16 free(input); 16 free(input);
17 wlr_log(WLR_DEBUG, "Unable to allocate input config"); 17 sway_log(SWAY_DEBUG, "Unable to allocate input config");
18 return NULL; 18 return NULL;
19 } 19 }
20 20
@@ -136,7 +136,7 @@ static void merge_wildcard_on_all(struct input_config *wildcard) {
136 for (int i = 0; i < config->input_configs->length; i++) { 136 for (int i = 0; i < config->input_configs->length; i++) {
137 struct input_config *ic = config->input_configs->items[i]; 137 struct input_config *ic = config->input_configs->items[i];
138 if (strcmp(wildcard->identifier, ic->identifier) != 0) { 138 if (strcmp(wildcard->identifier, ic->identifier) != 0) {
139 wlr_log(WLR_DEBUG, "Merging input * config on %s", ic->identifier); 139 sway_log(SWAY_DEBUG, "Merging input * config on %s", ic->identifier);
140 merge_input_config(ic, wildcard); 140 merge_input_config(ic, wildcard);
141 } 141 }
142 } 142 }
@@ -151,16 +151,16 @@ struct input_config *store_input_config(struct input_config *ic) {
151 int i = list_seq_find(config->input_configs, input_identifier_cmp, 151 int i = list_seq_find(config->input_configs, input_identifier_cmp,
152 ic->identifier); 152 ic->identifier);
153 if (i >= 0) { 153 if (i >= 0) {
154 wlr_log(WLR_DEBUG, "Merging on top of existing input config"); 154 sway_log(SWAY_DEBUG, "Merging on top of existing input config");
155 struct input_config *current = config->input_configs->items[i]; 155 struct input_config *current = config->input_configs->items[i];
156 merge_input_config(current, ic); 156 merge_input_config(current, ic);
157 free_input_config(ic); 157 free_input_config(ic);
158 ic = current; 158 ic = current;
159 } else if (!wildcard) { 159 } else if (!wildcard) {
160 wlr_log(WLR_DEBUG, "Adding non-wildcard input config"); 160 sway_log(SWAY_DEBUG, "Adding non-wildcard input config");
161 i = list_seq_find(config->input_configs, input_identifier_cmp, "*"); 161 i = list_seq_find(config->input_configs, input_identifier_cmp, "*");
162 if (i >= 0) { 162 if (i >= 0) {
163 wlr_log(WLR_DEBUG, "Merging on top of input * config"); 163 sway_log(SWAY_DEBUG, "Merging on top of input * config");
164 struct input_config *current = new_input_config(ic->identifier); 164 struct input_config *current = new_input_config(ic->identifier);
165 merge_input_config(current, config->input_configs->items[i]); 165 merge_input_config(current, config->input_configs->items[i]);
166 merge_input_config(current, ic); 166 merge_input_config(current, ic);
@@ -170,11 +170,11 @@ struct input_config *store_input_config(struct input_config *ic) {
170 list_add(config->input_configs, ic); 170 list_add(config->input_configs, ic);
171 } else { 171 } else {
172 // New wildcard config. Just add it 172 // New wildcard config. Just add it
173 wlr_log(WLR_DEBUG, "Adding input * config"); 173 sway_log(SWAY_DEBUG, "Adding input * config");
174 list_add(config->input_configs, ic); 174 list_add(config->input_configs, ic);
175 } 175 }
176 176
177 wlr_log(WLR_DEBUG, "Config stored for input %s", ic->identifier); 177 sway_log(SWAY_DEBUG, "Config stored for input %s", ic->identifier);
178 178
179 return ic; 179 return ic;
180} 180}
diff --git a/sway/config/output.c b/sway/config/output.c
index 8f59c863..ec833ffe 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -91,7 +91,7 @@ static void merge_wildcard_on_all(struct output_config *wildcard) {
91 for (int i = 0; i < config->output_configs->length; i++) { 91 for (int i = 0; i < config->output_configs->length; i++) {
92 struct output_config *oc = config->output_configs->items[i]; 92 struct output_config *oc = config->output_configs->items[i];
93 if (strcmp(wildcard->name, oc->name) != 0) { 93 if (strcmp(wildcard->name, oc->name) != 0) {
94 wlr_log(WLR_DEBUG, "Merging output * config on %s", oc->name); 94 sway_log(SWAY_DEBUG, "Merging output * config on %s", oc->name);
95 merge_output_config(oc, wildcard); 95 merge_output_config(oc, wildcard);
96 } 96 }
97 } 97 }
@@ -105,16 +105,16 @@ struct output_config *store_output_config(struct output_config *oc) {
105 105
106 int i = list_seq_find(config->output_configs, output_name_cmp, oc->name); 106 int i = list_seq_find(config->output_configs, output_name_cmp, oc->name);
107 if (i >= 0) { 107 if (i >= 0) {
108 wlr_log(WLR_DEBUG, "Merging on top of existing output config"); 108 sway_log(SWAY_DEBUG, "Merging on top of existing output config");
109 struct output_config *current = config->output_configs->items[i]; 109 struct output_config *current = config->output_configs->items[i];
110 merge_output_config(current, oc); 110 merge_output_config(current, oc);
111 free_output_config(oc); 111 free_output_config(oc);
112 oc = current; 112 oc = current;
113 } else if (!wildcard) { 113 } else if (!wildcard) {
114 wlr_log(WLR_DEBUG, "Adding non-wildcard output config"); 114 sway_log(SWAY_DEBUG, "Adding non-wildcard output config");
115 i = list_seq_find(config->output_configs, output_name_cmp, "*"); 115 i = list_seq_find(config->output_configs, output_name_cmp, "*");
116 if (i >= 0) { 116 if (i >= 0) {
117 wlr_log(WLR_DEBUG, "Merging on top of output * config"); 117 sway_log(SWAY_DEBUG, "Merging on top of output * config");
118 struct output_config *current = new_output_config(oc->name); 118 struct output_config *current = new_output_config(oc->name);
119 merge_output_config(current, config->output_configs->items[i]); 119 merge_output_config(current, config->output_configs->items[i]);
120 merge_output_config(current, oc); 120 merge_output_config(current, oc);
@@ -124,11 +124,11 @@ struct output_config *store_output_config(struct output_config *oc) {
124 list_add(config->output_configs, oc); 124 list_add(config->output_configs, oc);
125 } else { 125 } else {
126 // New wildcard config. Just add it 126 // New wildcard config. Just add it
127 wlr_log(WLR_DEBUG, "Adding output * config"); 127 sway_log(SWAY_DEBUG, "Adding output * config");
128 list_add(config->output_configs, oc); 128 list_add(config->output_configs, oc);
129 } 129 }
130 130
131 wlr_log(WLR_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " 131 sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
132 "position %d,%d scale %f transform %d) (bg %s %s) (dpms %d)", 132 "position %d,%d scale %f transform %d) (bg %s %s) (dpms %d)",
133 oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate, 133 oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate,
134 oc->x, oc->y, oc->scale, oc->transform, oc->background, 134 oc->x, oc->y, oc->scale, oc->transform, oc->background,
@@ -141,7 +141,7 @@ static bool set_mode(struct wlr_output *output, int width, int height,
141 float refresh_rate) { 141 float refresh_rate) {
142 int mhz = (int)(refresh_rate * 1000); 142 int mhz = (int)(refresh_rate * 1000);
143 if (wl_list_empty(&output->modes)) { 143 if (wl_list_empty(&output->modes)) {
144 wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name); 144 sway_log(SWAY_DEBUG, "Assigning custom mode to %s", output->name);
145 return wlr_output_set_custom_mode(output, width, height, mhz); 145 return wlr_output_set_custom_mode(output, width, height, mhz);
146 } 146 }
147 147
@@ -156,11 +156,11 @@ static bool set_mode(struct wlr_output *output, int width, int height,
156 } 156 }
157 } 157 }
158 if (!best) { 158 if (!best) {
159 wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name); 159 sway_log(SWAY_ERROR, "Configured mode for %s not available", output->name);
160 wlr_log(WLR_INFO, "Picking default mode instead"); 160 sway_log(SWAY_INFO, "Picking default mode instead");
161 best = wl_container_of(output->modes.prev, mode, link); 161 best = wl_container_of(output->modes.prev, mode, link);
162 } else { 162 } else {
163 wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name); 163 sway_log(SWAY_DEBUG, "Assigning configured mode to %s", output->name);
164 } 164 }
165 return wlr_output_set_mode(output, best); 165 return wlr_output_set_mode(output, best);
166} 166}
@@ -168,7 +168,7 @@ static bool set_mode(struct wlr_output *output, int width, int height,
168void terminate_swaybg(pid_t pid) { 168void terminate_swaybg(pid_t pid) {
169 int ret = kill(pid, SIGTERM); 169 int ret = kill(pid, SIGTERM);
170 if (ret != 0) { 170 if (ret != 0) {
171 wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid); 171 sway_log(SWAY_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
172 } else { 172 } else {
173 int status; 173 int status;
174 waitpid(pid, &status, 0); 174 waitpid(pid, &status, 0);
@@ -197,7 +197,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
197 197
198 bool modeset_success; 198 bool modeset_success;
199 if (oc && oc->width > 0 && oc->height > 0) { 199 if (oc && oc->width > 0 && oc->height > 0) {
200 wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, 200 sway_log(SWAY_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
201 oc->height, oc->refresh_rate); 201 oc->height, oc->refresh_rate);
202 modeset_success = 202 modeset_success =
203 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); 203 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
@@ -213,22 +213,22 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
213 // Failed to modeset, maybe the output is missing a CRTC. Leave the 213 // Failed to modeset, maybe the output is missing a CRTC. Leave the
214 // output disabled for now and try again when the output gets the mode 214 // output disabled for now and try again when the output gets the mode
215 // we asked for. 215 // we asked for.
216 wlr_log(WLR_ERROR, "Failed to modeset output %s", wlr_output->name); 216 sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name);
217 return false; 217 return false;
218 } 218 }
219 219
220 if (oc && oc->scale > 0) { 220 if (oc && oc->scale > 0) {
221 wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale); 221 sway_log(SWAY_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
222 wlr_output_set_scale(wlr_output, oc->scale); 222 wlr_output_set_scale(wlr_output, oc->scale);
223 } 223 }
224 if (oc && oc->transform >= 0) { 224 if (oc && oc->transform >= 0) {
225 wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform); 225 sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
226 wlr_output_set_transform(wlr_output, oc->transform); 226 wlr_output_set_transform(wlr_output, oc->transform);
227 } 227 }
228 228
229 // Find position for it 229 // Find position for it
230 if (oc && (oc->x != -1 || oc->y != -1)) { 230 if (oc && (oc->x != -1 || oc->y != -1)) {
231 wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); 231 sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
232 wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y); 232 wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y);
233 } else { 233 } else {
234 wlr_output_layout_add_auto(root->output_layout, wlr_output); 234 wlr_output_layout_add_auto(root->output_layout, wlr_output);
@@ -238,7 +238,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
238 terminate_swaybg(output->bg_pid); 238 terminate_swaybg(output->bg_pid);
239 } 239 }
240 if (oc && oc->background && config->swaybg_command) { 240 if (oc && oc->background && config->swaybg_command) {
241 wlr_log(WLR_DEBUG, "Setting background for output %s to %s", 241 sway_log(SWAY_DEBUG, "Setting background for output %s to %s",
242 wlr_output->name, oc->background); 242 wlr_output->name, oc->background);
243 243
244 char *const cmd[] = { 244 char *const cmd[] = {
@@ -252,21 +252,21 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
252 252
253 output->bg_pid = fork(); 253 output->bg_pid = fork();
254 if (output->bg_pid < 0) { 254 if (output->bg_pid < 0) {
255 wlr_log_errno(WLR_ERROR, "fork failed"); 255 sway_log_errno(SWAY_ERROR, "fork failed");
256 } else if (output->bg_pid == 0) { 256 } else if (output->bg_pid == 0) {
257 execvp(cmd[0], cmd); 257 execvp(cmd[0], cmd);
258 wlr_log_errno(WLR_ERROR, "Failed to execute swaybg"); 258 sway_log_errno(SWAY_ERROR, "Failed to execute swaybg");
259 } 259 }
260 } 260 }
261 261
262 if (oc) { 262 if (oc) {
263 switch (oc->dpms_state) { 263 switch (oc->dpms_state) {
264 case DPMS_ON: 264 case DPMS_ON:
265 wlr_log(WLR_DEBUG, "Turning on screen"); 265 sway_log(SWAY_DEBUG, "Turning on screen");
266 wlr_output_enable(wlr_output, true); 266 wlr_output_enable(wlr_output, true);
267 break; 267 break;
268 case DPMS_OFF: 268 case DPMS_OFF:
269 wlr_log(WLR_DEBUG, "Turning off screen"); 269 sway_log(SWAY_DEBUG, "Turning off screen");
270 wlr_output_enable(wlr_output, false); 270 wlr_output_enable(wlr_output, false);
271 break; 271 break;
272 case DPMS_IGNORE: 272 case DPMS_IGNORE:
@@ -325,7 +325,7 @@ static struct output_config *get_output_config(char *identifier,
325 merge_output_config(result, oc_name); 325 merge_output_config(result, oc_name);
326 merge_output_config(result, oc_id); 326 merge_output_config(result, oc_id);
327 327
328 wlr_log(WLR_DEBUG, "Generated output config \"%s\" (enabled: %d)" 328 sway_log(SWAY_DEBUG, "Generated output config \"%s\" (enabled: %d)"
329 " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)" 329 " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)"
330 " (dpms %d)", result->name, result->enabled, result->width, 330 " (dpms %d)", result->name, result->enabled, result->width,
331 result->height, result->refresh_rate, result->x, result->y, 331 result->height, result->refresh_rate, result->x, result->y,
diff --git a/sway/config/seat.c b/sway/config/seat.c
index d7316c68..92dc42e3 100644
--- a/sway/config/seat.c
+++ b/sway/config/seat.c
@@ -7,7 +7,7 @@
7struct seat_config *new_seat_config(const char* name) { 7struct seat_config *new_seat_config(const char* name) {
8 struct seat_config *seat = calloc(1, sizeof(struct seat_config)); 8 struct seat_config *seat = calloc(1, sizeof(struct seat_config));
9 if (!seat) { 9 if (!seat) {
10 wlr_log(WLR_DEBUG, "Unable to allocate seat config"); 10 sway_log(SWAY_DEBUG, "Unable to allocate seat config");
11 return NULL; 11 return NULL;
12 } 12 }
13 13
@@ -34,7 +34,7 @@ static void merge_wildcard_on_all(struct seat_config *wildcard) {
34 for (int i = 0; i < config->seat_configs->length; i++) { 34 for (int i = 0; i < config->seat_configs->length; i++) {
35 struct seat_config *sc = config->seat_configs->items[i]; 35 struct seat_config *sc = config->seat_configs->items[i];
36 if (strcmp(wildcard->name, sc->name) != 0) { 36 if (strcmp(wildcard->name, sc->name) != 0) {
37 wlr_log(WLR_DEBUG, "Merging seat * config on %s", sc->name); 37 sway_log(SWAY_DEBUG, "Merging seat * config on %s", sc->name);
38 merge_seat_config(sc, wildcard); 38 merge_seat_config(sc, wildcard);
39 } 39 }
40 } 40 }
@@ -48,16 +48,16 @@ struct seat_config *store_seat_config(struct seat_config *sc) {
48 48
49 int i = list_seq_find(config->seat_configs, seat_name_cmp, sc->name); 49 int i = list_seq_find(config->seat_configs, seat_name_cmp, sc->name);
50 if (i >= 0) { 50 if (i >= 0) {
51 wlr_log(WLR_DEBUG, "Merging on top of existing seat config"); 51 sway_log(SWAY_DEBUG, "Merging on top of existing seat config");
52 struct seat_config *current = config->seat_configs->items[i]; 52 struct seat_config *current = config->seat_configs->items[i];
53 merge_seat_config(current, sc); 53 merge_seat_config(current, sc);
54 free_seat_config(sc); 54 free_seat_config(sc);
55 sc = current; 55 sc = current;
56 } else if (!wildcard) { 56 } else if (!wildcard) {
57 wlr_log(WLR_DEBUG, "Adding non-wildcard seat config"); 57 sway_log(SWAY_DEBUG, "Adding non-wildcard seat config");
58 i = list_seq_find(config->seat_configs, seat_name_cmp, "*"); 58 i = list_seq_find(config->seat_configs, seat_name_cmp, "*");
59 if (i >= 0) { 59 if (i >= 0) {
60 wlr_log(WLR_DEBUG, "Merging on top of seat * config"); 60 sway_log(SWAY_DEBUG, "Merging on top of seat * config");
61 struct seat_config *current = new_seat_config(sc->name); 61 struct seat_config *current = new_seat_config(sc->name);
62 merge_seat_config(current, config->seat_configs->items[i]); 62 merge_seat_config(current, config->seat_configs->items[i]);
63 merge_seat_config(current, sc); 63 merge_seat_config(current, sc);
@@ -67,11 +67,11 @@ struct seat_config *store_seat_config(struct seat_config *sc) {
67 list_add(config->seat_configs, sc); 67 list_add(config->seat_configs, sc);
68 } else { 68 } else {
69 // New wildcard config. Just add it 69 // New wildcard config. Just add it
70 wlr_log(WLR_DEBUG, "Adding seat * config"); 70 sway_log(SWAY_DEBUG, "Adding seat * config");
71 list_add(config->seat_configs, sc); 71 list_add(config->seat_configs, sc);
72 } 72 }
73 73
74 wlr_log(WLR_DEBUG, "Config stored for seat %s", sc->name); 74 sway_log(SWAY_DEBUG, "Config stored for seat %s", sc->name);
75 75
76 return sc; 76 return sc;
77} 77}
@@ -80,7 +80,7 @@ struct seat_attachment_config *seat_attachment_config_new(void) {
80 struct seat_attachment_config *attachment = 80 struct seat_attachment_config *attachment =
81 calloc(1, sizeof(struct seat_attachment_config)); 81 calloc(1, sizeof(struct seat_attachment_config));
82 if (!attachment) { 82 if (!attachment) {
83 wlr_log(WLR_DEBUG, "cannot allocate attachment config"); 83 sway_log(SWAY_DEBUG, "cannot allocate attachment config");
84 return NULL; 84 return NULL;
85 } 85 }
86 return attachment; 86 return attachment;
diff --git a/sway/criteria.c b/sway/criteria.c
index 54583b04..59a923f9 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -626,7 +626,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
626 } 626 }
627 unescape(value); 627 unescape(value);
628 } 628 }
629 wlr_log(WLR_DEBUG, "Found pair: %s=%s", name, value); 629 sway_log(SWAY_DEBUG, "Found pair: %s=%s", name, value);
630 if (!parse_token(criteria, name, value)) { 630 if (!parse_token(criteria, name, value)) {
631 *error_arg = error; 631 *error_arg = error;
632 goto cleanup; 632 goto cleanup;
diff --git a/sway/debug-tree.c b/sway/debug-tree.c
index b3266241..0444bb3f 100644
--- a/sway/debug-tree.c
+++ b/sway/debug-tree.c
@@ -1,7 +1,6 @@
1#include <pango/pangocairo.h> 1#include <pango/pangocairo.h>
2#include <wlr/backend.h> 2#include <wlr/backend.h>
3#include <wlr/render/wlr_texture.h> 3#include <wlr/render/wlr_texture.h>
4#include <wlr/util/log.h>
5#include "config.h" 4#include "config.h"
6#include "sway/debug.h" 5#include "sway/debug.h"
7#include "sway/input/input-manager.h" 6#include "sway/input/input-manager.h"
diff --git a/sway/desktop/idle_inhibit_v1.c b/sway/desktop/idle_inhibit_v1.c
index 17d4242b..87b4ef43 100644
--- a/sway/desktop/idle_inhibit_v1.c
+++ b/sway/desktop/idle_inhibit_v1.c
@@ -9,7 +9,7 @@
9static void handle_destroy(struct wl_listener *listener, void *data) { 9static void handle_destroy(struct wl_listener *listener, void *data) {
10 struct sway_idle_inhibitor_v1 *inhibitor = 10 struct sway_idle_inhibitor_v1 *inhibitor =
11 wl_container_of(listener, inhibitor, destroy); 11 wl_container_of(listener, inhibitor, destroy);
12 wlr_log(WLR_DEBUG, "Sway idle inhibitor destroyed"); 12 sway_log(SWAY_DEBUG, "Sway idle inhibitor destroyed");
13 wl_list_remove(&inhibitor->link); 13 wl_list_remove(&inhibitor->link);
14 wl_list_remove(&inhibitor->destroy.link); 14 wl_list_remove(&inhibitor->destroy.link);
15 idle_inhibit_v1_check_active(inhibitor->manager); 15 idle_inhibit_v1_check_active(inhibitor->manager);
@@ -20,7 +20,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data) {
20 struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data; 20 struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data;
21 struct sway_idle_inhibit_manager_v1 *manager = 21 struct sway_idle_inhibit_manager_v1 *manager =
22 wl_container_of(listener, manager, new_idle_inhibitor_v1); 22 wl_container_of(listener, manager, new_idle_inhibitor_v1);
23 wlr_log(WLR_DEBUG, "New sway idle inhibitor"); 23 sway_log(SWAY_DEBUG, "New sway idle inhibitor");
24 24
25 struct sway_idle_inhibitor_v1 *inhibitor = 25 struct sway_idle_inhibitor_v1 *inhibitor =
26 calloc(1, sizeof(struct sway_idle_inhibitor_v1)); 26 calloc(1, sizeof(struct sway_idle_inhibitor_v1));
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index ab05778d..a870bb9a 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -6,7 +6,6 @@
6#include <wlr/types/wlr_layer_shell_v1.h> 6#include <wlr/types/wlr_layer_shell_v1.h>
7#include <wlr/types/wlr_output_damage.h> 7#include <wlr/types/wlr_output_damage.h>
8#include <wlr/types/wlr_output.h> 8#include <wlr/types/wlr_output.h>
9#include <wlr/util/log.h>
10#include "sway/desktop/transaction.h" 9#include "sway/desktop/transaction.h"
11#include "sway/input/input-manager.h" 10#include "sway/input/input-manager.h"
12#include "sway/input/seat.h" 11#include "sway/input/seat.h"
@@ -175,7 +174,7 @@ void arrange_layers(struct sway_output *output) {
175 174
176 if (memcmp(&usable_area, &output->usable_area, 175 if (memcmp(&usable_area, &output->usable_area,
177 sizeof(struct wlr_box)) != 0) { 176 sizeof(struct wlr_box)) != 0) {
178 wlr_log(WLR_DEBUG, "Usable area changed, rearranging output"); 177 sway_log(SWAY_DEBUG, "Usable area changed, rearranging output");
179 memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); 178 memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box));
180 arrange_output(output); 179 arrange_output(output);
181 } 180 }
@@ -308,7 +307,7 @@ static void unmap(struct sway_layer_surface *sway_layer) {
308static void handle_destroy(struct wl_listener *listener, void *data) { 307static void handle_destroy(struct wl_listener *listener, void *data) {
309 struct sway_layer_surface *sway_layer = 308 struct sway_layer_surface *sway_layer =
310 wl_container_of(listener, sway_layer, destroy); 309 wl_container_of(listener, sway_layer, destroy);
311 wlr_log(WLR_DEBUG, "Layer surface destroyed (%s)", 310 sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)",
312 sway_layer->layer_surface->namespace); 311 sway_layer->layer_surface->namespace);
313 if (sway_layer->layer_surface->mapped) { 312 if (sway_layer->layer_surface->mapped) {
314 unmap(sway_layer); 313 unmap(sway_layer);
@@ -357,7 +356,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
357 struct wlr_layer_surface_v1 *layer_surface = data; 356 struct wlr_layer_surface_v1 *layer_surface = data;
358 struct sway_server *server = 357 struct sway_server *server =
359 wl_container_of(listener, server, layer_shell_surface); 358 wl_container_of(listener, server, layer_shell_surface);
360 wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " 359 sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
361 "size %dx%d margin %d,%d,%d,%d", 360 "size %dx%d margin %d,%d,%d,%d",
362 layer_surface->namespace, layer_surface->layer, layer_surface->layer, 361 layer_surface->namespace, layer_surface->layer, layer_surface->layer,
363 layer_surface->client_pending.desired_width, 362 layer_surface->client_pending.desired_width,
@@ -380,7 +379,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
380 } 379 }
381 if (!output) { 380 if (!output) {
382 if (!root->outputs->length) { 381 if (!root->outputs->length) {
383 wlr_log(WLR_ERROR, 382 sway_log(SWAY_ERROR,
384 "no output to auto-assign layer surface '%s' to", 383 "no output to auto-assign layer surface '%s' to",
385 layer_surface->namespace); 384 layer_surface->namespace);
386 wlr_layer_surface_v1_close(layer_surface); 385 wlr_layer_surface_v1_close(layer_surface);
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 646b6d70..edf77fbc 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -510,7 +510,7 @@ static void handle_mode(struct wl_listener *listener, void *data) {
510 // We want to enable this output, but it didn't work last time, 510 // We want to enable this output, but it didn't work last time,
511 // possibly because we hadn't enough CRTCs. Try again now that the 511 // possibly because we hadn't enough CRTCs. Try again now that the
512 // output has a mode. 512 // output has a mode.
513 wlr_log(WLR_DEBUG, "Output %s has gained a CRTC, " 513 sway_log(SWAY_DEBUG, "Output %s has gained a CRTC, "
514 "trying to enable it", output->wlr_output->name); 514 "trying to enable it", output->wlr_output->name);
515 apply_output_config(oc, output); 515 apply_output_config(oc, output);
516 } 516 }
@@ -580,7 +580,7 @@ static void handle_present(struct wl_listener *listener, void *data) {
580void handle_new_output(struct wl_listener *listener, void *data) { 580void handle_new_output(struct wl_listener *listener, void *data) {
581 struct sway_server *server = wl_container_of(listener, server, new_output); 581 struct sway_server *server = wl_container_of(listener, server, new_output);
582 struct wlr_output *wlr_output = data; 582 struct wlr_output *wlr_output = data;
583 wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); 583 sway_log(SWAY_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
584 584
585 struct sway_output *output = output_create(wlr_output); 585 struct sway_output *output = output_create(wlr_output);
586 if (!output) { 586 if (!output) {
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 1cdd7c6d..55cf1c5e 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -260,14 +260,14 @@ static void apply_container_state(struct sway_container *container,
260 * Apply a transaction to the "current" state of the tree. 260 * Apply a transaction to the "current" state of the tree.
261 */ 261 */
262static void transaction_apply(struct sway_transaction *transaction) { 262static void transaction_apply(struct sway_transaction *transaction) {
263 wlr_log(WLR_DEBUG, "Applying transaction %p", transaction); 263 sway_log(SWAY_DEBUG, "Applying transaction %p", transaction);
264 if (debug.txn_timings) { 264 if (debug.txn_timings) {
265 struct timespec now; 265 struct timespec now;
266 clock_gettime(CLOCK_MONOTONIC, &now); 266 clock_gettime(CLOCK_MONOTONIC, &now);
267 struct timespec *commit = &transaction->commit_time; 267 struct timespec *commit = &transaction->commit_time;
268 float ms = (now.tv_sec - commit->tv_sec) * 1000 + 268 float ms = (now.tv_sec - commit->tv_sec) * 1000 +
269 (now.tv_nsec - commit->tv_nsec) / 1000000.0; 269 (now.tv_nsec - commit->tv_nsec) / 1000000.0;
270 wlr_log(WLR_DEBUG, "Transaction %p: %.1fms waiting " 270 sway_log(SWAY_DEBUG, "Transaction %p: %.1fms waiting "
271 "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60)); 271 "(%.1f frames if 60Hz)", transaction, ms, ms / (1000.0f / 60));
272 } 272 }
273 273
@@ -363,7 +363,7 @@ static void transaction_progress_queue(void) {
363 363
364static int handle_timeout(void *data) { 364static int handle_timeout(void *data) {
365 struct sway_transaction *transaction = data; 365 struct sway_transaction *transaction = data;
366 wlr_log(WLR_DEBUG, "Transaction %p timed out (%zi waiting)", 366 sway_log(SWAY_DEBUG, "Transaction %p timed out (%zi waiting)",
367 transaction, transaction->num_waiting); 367 transaction, transaction->num_waiting);
368 transaction->num_waiting = 0; 368 transaction->num_waiting = 0;
369 transaction_progress_queue(); 369 transaction_progress_queue();
@@ -398,7 +398,7 @@ static bool should_configure(struct sway_node *node,
398} 398}
399 399
400static void transaction_commit(struct sway_transaction *transaction) { 400static void transaction_commit(struct sway_transaction *transaction) {
401 wlr_log(WLR_DEBUG, "Transaction %p committing with %i instructions", 401 sway_log(SWAY_DEBUG, "Transaction %p committing with %i instructions",
402 transaction, transaction->instructions->length); 402 transaction, transaction->instructions->length);
403 transaction->num_waiting = 0; 403 transaction->num_waiting = 0;
404 for (int i = 0; i < transaction->instructions->length; ++i) { 404 for (int i = 0; i < transaction->instructions->length; ++i) {
@@ -449,7 +449,7 @@ static void transaction_commit(struct sway_transaction *transaction) {
449 wl_event_source_timer_update(transaction->timer, 449 wl_event_source_timer_update(transaction->timer,
450 server.txn_timeout_ms); 450 server.txn_timeout_ms);
451 } else { 451 } else {
452 wlr_log(WLR_ERROR, "Unable to create transaction timer (%s). " 452 sway_log(SWAY_ERROR, "Unable to create transaction timer (%s). "
453 "Some imperfect frames might be rendered.", 453 "Some imperfect frames might be rendered.",
454 strerror(errno)); 454 strerror(errno));
455 transaction->num_waiting = 0; 455 transaction->num_waiting = 0;
@@ -472,7 +472,7 @@ static void set_instruction_ready(
472 struct timespec *start = &transaction->commit_time; 472 struct timespec *start = &transaction->commit_time;
473 float ms = (now.tv_sec - start->tv_sec) * 1000 + 473 float ms = (now.tv_sec - start->tv_sec) * 1000 +
474 (now.tv_nsec - start->tv_nsec) / 1000000.0; 474 (now.tv_nsec - start->tv_nsec) / 1000000.0;
475 wlr_log(WLR_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)", 475 sway_log(SWAY_DEBUG, "Transaction %p: %zi/%zi ready in %.1fms (%s)",
476 transaction, 476 transaction,
477 transaction->num_configures - transaction->num_waiting + 1, 477 transaction->num_configures - transaction->num_waiting + 1,
478 transaction->num_configures, ms, 478 transaction->num_configures, ms,
@@ -481,7 +481,7 @@ static void set_instruction_ready(
481 481
482 // If the transaction has timed out then its num_waiting will be 0 already. 482 // If the transaction has timed out then its num_waiting will be 0 already.
483 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { 483 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
484 wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction); 484 sway_log(SWAY_DEBUG, "Transaction %p is ready", transaction);
485 wl_event_source_timer_update(transaction->timer, 0); 485 wl_event_source_timer_update(transaction->timer, 0);
486 } 486 }
487 487
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 7da86136..b4ac3a68 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -485,11 +485,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
485 struct wlr_xdg_surface *xdg_surface = data; 485 struct wlr_xdg_surface *xdg_surface = data;
486 486
487 if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { 487 if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
488 wlr_log(WLR_DEBUG, "New xdg_shell popup"); 488 sway_log(SWAY_DEBUG, "New xdg_shell popup");
489 return; 489 return;
490 } 490 }
491 491
492 wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", 492 sway_log(SWAY_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
493 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); 493 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
494 wlr_xdg_surface_ping(xdg_surface); 494 wlr_xdg_surface_ping(xdg_surface);
495 495
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 9f6741c8..553d532d 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -469,11 +469,11 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
469 struct wlr_xdg_surface_v6 *xdg_surface = data; 469 struct wlr_xdg_surface_v6 *xdg_surface = data;
470 470
471 if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { 471 if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
472 wlr_log(WLR_DEBUG, "New xdg_shell_v6 popup"); 472 sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup");
473 return; 473 return;
474 } 474 }
475 475
476 wlr_log(WLR_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", 476 sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",
477 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); 477 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
478 wlr_xdg_surface_v6_ping(xdg_surface); 478 wlr_xdg_surface_v6_ping(xdg_surface);
479 479
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 080f6c41..8dcf4bd6 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -118,7 +118,7 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
118 struct sway_xwayland_unmanaged *surface = 118 struct sway_xwayland_unmanaged *surface =
119 calloc(1, sizeof(struct sway_xwayland_unmanaged)); 119 calloc(1, sizeof(struct sway_xwayland_unmanaged));
120 if (surface == NULL) { 120 if (surface == NULL) {
121 wlr_log(WLR_ERROR, "Allocation failed"); 121 sway_log(SWAY_ERROR, "Allocation failed");
122 return NULL; 122 return NULL;
123 } 123 }
124 124
@@ -578,12 +578,12 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
578 struct wlr_xwayland_surface *xsurface = data; 578 struct wlr_xwayland_surface *xsurface = data;
579 579
580 if (xsurface->override_redirect) { 580 if (xsurface->override_redirect) {
581 wlr_log(WLR_DEBUG, "New xwayland unmanaged surface"); 581 sway_log(SWAY_DEBUG, "New xwayland unmanaged surface");
582 create_unmanaged(xsurface); 582 create_unmanaged(xsurface);
583 return; 583 return;
584 } 584 }
585 585
586 wlr_log(WLR_DEBUG, "New xwayland surface title='%s' class='%s'", 586 sway_log(SWAY_DEBUG, "New xwayland surface title='%s' class='%s'",
587 xsurface->title, xsurface->class); 587 xsurface->title, xsurface->class);
588 588
589 struct sway_xwayland_view *xwayland_view = 589 struct sway_xwayland_view *xwayland_view =
@@ -655,7 +655,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
655 xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL); 655 xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL);
656 int err = xcb_connection_has_error(xcb_conn); 656 int err = xcb_connection_has_error(xcb_conn);
657 if (err) { 657 if (err) {
658 wlr_log(WLR_ERROR, "XCB connect failed: %d", err); 658 sway_log(SWAY_ERROR, "XCB connect failed: %d", err);
659 return; 659 return;
660 } 660 }
661 661
@@ -674,7 +674,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
674 free(reply); 674 free(reply);
675 675
676 if (error != NULL) { 676 if (error != NULL) {
677 wlr_log(WLR_ERROR, "could not resolve atom %s, X11 error code %d", 677 sway_log(SWAY_ERROR, "could not resolve atom %s, X11 error code %d",
678 atom_map[i], error->error_code); 678 atom_map[i], error->error_code);
679 free(error); 679 free(error);
680 break; 680 break;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 35683f06..bf9bf2da 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -713,7 +713,7 @@ static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) {
713 case WLR_AXIS_ORIENTATION_HORIZONTAL: 713 case WLR_AXIS_ORIENTATION_HORIZONTAL:
714 return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; 714 return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT;
715 default: 715 default:
716 wlr_log(WLR_DEBUG, "Unknown axis orientation"); 716 sway_log(SWAY_DEBUG, "Unknown axis orientation");
717 return 0; 717 return 0;
718 } 718 }
719} 719}
@@ -1004,7 +1004,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
1004 // TODO: check cursor mode 1004 // TODO: check cursor mode
1005 if (focused_client == NULL || 1005 if (focused_client == NULL ||
1006 event->seat_client->client != focused_client) { 1006 event->seat_client->client != focused_client) {
1007 wlr_log(WLR_DEBUG, "denying request to set cursor from unfocused client"); 1007 sway_log(SWAY_DEBUG, "denying request to set cursor from unfocused client");
1008 return; 1008 return;
1009 } 1009 }
1010 1010
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 9fff5f48..2b4a99d4 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -62,7 +62,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) {
62 int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1; 62 int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
63 char *identifier = malloc(len); 63 char *identifier = malloc(len);
64 if (!identifier) { 64 if (!identifier) {
65 wlr_log(WLR_ERROR, "Unable to allocate unique input device name"); 65 sway_log(SWAY_ERROR, "Unable to allocate unique input device name");
66 return NULL; 66 return NULL;
67 } 67 }
68 68
@@ -98,7 +98,7 @@ static bool input_has_seat_fallback_configuration(void) {
98void input_manager_verify_fallback_seat(void) { 98void input_manager_verify_fallback_seat(void) {
99 struct sway_seat *seat = NULL; 99 struct sway_seat *seat = NULL;
100 if (!input_has_seat_fallback_configuration()) { 100 if (!input_has_seat_fallback_configuration()) {
101 wlr_log(WLR_DEBUG, "no fallback seat config - creating default"); 101 sway_log(SWAY_DEBUG, "no fallback seat config - creating default");
102 seat = input_manager_get_default_seat(); 102 seat = input_manager_get_default_seat();
103 struct seat_config *sc = new_seat_config(seat->wlr_seat->name); 103 struct seat_config *sc = new_seat_config(seat->wlr_seat->name);
104 sc->fallback = true; 104 sc->fallback = true;
@@ -124,11 +124,11 @@ static void input_manager_libinput_config_keyboard(
124 } 124 }
125 125
126 libinput_device = wlr_libinput_get_device_handle(wlr_device); 126 libinput_device = wlr_libinput_get_device_handle(wlr_device);
127 wlr_log(WLR_DEBUG, "input_manager_libinput_config_keyboard(%s)", 127 sway_log(SWAY_DEBUG, "input_manager_libinput_config_keyboard(%s)",
128 ic->identifier); 128 ic->identifier);
129 129
130 if (ic->send_events != INT_MIN) { 130 if (ic->send_events != INT_MIN) {
131 wlr_log(WLR_DEBUG, "libinput_config_keyboard(%s) send_events_set_mode(%d)", 131 sway_log(SWAY_DEBUG, "libinput_config_keyboard(%s) send_events_set_mode(%d)",
132 ic->identifier, ic->send_events); 132 ic->identifier, ic->send_events);
133 log_libinput_config_status(libinput_device_config_send_events_set_mode( 133 log_libinput_config_status(libinput_device_config_send_events_set_mode(
134 libinput_device, ic->send_events)); 134 libinput_device, ic->send_events));
@@ -148,7 +148,7 @@ static void input_manager_libinput_reset_keyboard(
148 148
149 uint32_t send_events = 149 uint32_t send_events =
150 libinput_device_config_send_events_get_default_mode(libinput_device); 150 libinput_device_config_send_events_get_default_mode(libinput_device);
151 wlr_log(WLR_DEBUG, "libinput_reset_keyboard(%s) send_events_set_mode(%d)", 151 sway_log(SWAY_DEBUG, "libinput_reset_keyboard(%s) send_events_set_mode(%d)",
152 input_device->identifier, send_events); 152 input_device->identifier, send_events);
153 log_libinput_config_status(libinput_device_config_send_events_set_mode( 153 log_libinput_config_status(libinput_device_config_send_events_set_mode(
154 libinput_device, send_events)); 154 libinput_device, send_events));
@@ -165,11 +165,11 @@ static void input_manager_libinput_config_touch(
165 } 165 }
166 166
167 libinput_device = wlr_libinput_get_device_handle(wlr_device); 167 libinput_device = wlr_libinput_get_device_handle(wlr_device);
168 wlr_log(WLR_DEBUG, "input_manager_libinput_config_touch(%s)", 168 sway_log(SWAY_DEBUG, "input_manager_libinput_config_touch(%s)",
169 ic->identifier); 169 ic->identifier);
170 170
171 if (ic->send_events != INT_MIN) { 171 if (ic->send_events != INT_MIN) {
172 wlr_log(WLR_DEBUG, "libinput_config_touch(%s) send_events_set_mode(%d)", 172 sway_log(SWAY_DEBUG, "libinput_config_touch(%s) send_events_set_mode(%d)",
173 ic->identifier, ic->send_events); 173 ic->identifier, ic->send_events);
174 log_libinput_config_status(libinput_device_config_send_events_set_mode( 174 log_libinput_config_status(libinput_device_config_send_events_set_mode(
175 libinput_device, ic->send_events)); 175 libinput_device, ic->send_events));
@@ -189,7 +189,7 @@ static void input_manager_libinput_reset_touch(
189 189
190 uint32_t send_events = 190 uint32_t send_events =
191 libinput_device_config_send_events_get_default_mode(libinput_device); 191 libinput_device_config_send_events_get_default_mode(libinput_device);
192 wlr_log(WLR_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)", 192 sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)",
193 input_device->identifier, send_events); 193 input_device->identifier, send_events);
194 log_libinput_config_status(libinput_device_config_send_events_set_mode( 194 log_libinput_config_status(libinput_device_config_send_events_set_mode(
195 libinput_device, send_events)); 195 libinput_device, send_events));
@@ -206,30 +206,30 @@ static void input_manager_libinput_config_pointer(
206 } 206 }
207 207
208 libinput_device = wlr_libinput_get_device_handle(wlr_device); 208 libinput_device = wlr_libinput_get_device_handle(wlr_device);
209 wlr_log(WLR_DEBUG, "input_manager_libinput_config_pointer(%s)", 209 sway_log(SWAY_DEBUG, "input_manager_libinput_config_pointer(%s)",
210 ic->identifier); 210 ic->identifier);
211 211
212 if (ic->accel_profile != INT_MIN) { 212 if (ic->accel_profile != INT_MIN) {
213 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", 213 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
214 ic->identifier, ic->accel_profile); 214 ic->identifier, ic->accel_profile);
215 log_libinput_config_status(libinput_device_config_accel_set_profile( 215 log_libinput_config_status(libinput_device_config_accel_set_profile(
216 libinput_device, ic->accel_profile)); 216 libinput_device, ic->accel_profile));
217 } 217 }
218 if (ic->click_method != INT_MIN) { 218 if (ic->click_method != INT_MIN) {
219 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", 219 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
220 ic->identifier, ic->click_method); 220 ic->identifier, ic->click_method);
221 log_libinput_config_status(libinput_device_config_click_set_method( 221 log_libinput_config_status(libinput_device_config_click_set_method(
222 libinput_device, ic->click_method)); 222 libinput_device, ic->click_method));
223 } 223 }
224 if (ic->drag != INT_MIN) { 224 if (ic->drag != INT_MIN) {
225 wlr_log(WLR_DEBUG, 225 sway_log(SWAY_DEBUG,
226 "libinput_config_pointer(%s) tap_set_drag_enabled(%d)", 226 "libinput_config_pointer(%s) tap_set_drag_enabled(%d)",
227 ic->identifier, ic->drag); 227 ic->identifier, ic->drag);
228 log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( 228 log_libinput_config_status(libinput_device_config_tap_set_drag_enabled(
229 libinput_device, ic->drag)); 229 libinput_device, ic->drag));
230 } 230 }
231 if (ic->drag_lock != INT_MIN) { 231 if (ic->drag_lock != INT_MIN) {
232 wlr_log(WLR_DEBUG, 232 sway_log(SWAY_DEBUG,
233 "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)", 233 "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
234 ic->identifier, ic->drag_lock); 234 ic->identifier, ic->drag_lock);
235 log_libinput_config_status( 235 log_libinput_config_status(
@@ -237,20 +237,20 @@ static void input_manager_libinput_config_pointer(
237 libinput_device, ic->drag_lock)); 237 libinput_device, ic->drag_lock));
238 } 238 }
239 if (ic->dwt != INT_MIN) { 239 if (ic->dwt != INT_MIN) {
240 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", 240 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
241 ic->identifier, ic->dwt); 241 ic->identifier, ic->dwt);
242 log_libinput_config_status(libinput_device_config_dwt_set_enabled( 242 log_libinput_config_status(libinput_device_config_dwt_set_enabled(
243 libinput_device, ic->dwt)); 243 libinput_device, ic->dwt));
244 } 244 }
245 if (ic->left_handed != INT_MIN) { 245 if (ic->left_handed != INT_MIN) {
246 wlr_log(WLR_DEBUG, 246 sway_log(SWAY_DEBUG,
247 "libinput_config_pointer(%s) left_handed_set_enabled(%d)", 247 "libinput_config_pointer(%s) left_handed_set_enabled(%d)",
248 ic->identifier, ic->left_handed); 248 ic->identifier, ic->left_handed);
249 log_libinput_config_status(libinput_device_config_left_handed_set( 249 log_libinput_config_status(libinput_device_config_left_handed_set(
250 libinput_device, ic->left_handed)); 250 libinput_device, ic->left_handed));
251 } 251 }
252 if (ic->middle_emulation != INT_MIN) { 252 if (ic->middle_emulation != INT_MIN) {
253 wlr_log(WLR_DEBUG, 253 sway_log(SWAY_DEBUG,
254 "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)", 254 "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
255 ic->identifier, ic->middle_emulation); 255 ic->identifier, ic->middle_emulation);
256 log_libinput_config_status( 256 log_libinput_config_status(
@@ -258,7 +258,7 @@ static void input_manager_libinput_config_pointer(
258 libinput_device, ic->middle_emulation)); 258 libinput_device, ic->middle_emulation));
259 } 259 }
260 if (ic->natural_scroll != INT_MIN) { 260 if (ic->natural_scroll != INT_MIN) {
261 wlr_log(WLR_DEBUG, 261 sway_log(SWAY_DEBUG,
262 "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)", 262 "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
263 ic->identifier, ic->natural_scroll); 263 ic->identifier, ic->natural_scroll);
264 log_libinput_config_status( 264 log_libinput_config_status(
@@ -266,37 +266,37 @@ static void input_manager_libinput_config_pointer(
266 libinput_device, ic->natural_scroll)); 266 libinput_device, ic->natural_scroll));
267 } 267 }
268 if (ic->pointer_accel != FLT_MIN) { 268 if (ic->pointer_accel != FLT_MIN) {
269 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", 269 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
270 ic->identifier, ic->pointer_accel); 270 ic->identifier, ic->pointer_accel);
271 log_libinput_config_status(libinput_device_config_accel_set_speed( 271 log_libinput_config_status(libinput_device_config_accel_set_speed(
272 libinput_device, ic->pointer_accel)); 272 libinput_device, ic->pointer_accel));
273 } 273 }
274 if (ic->scroll_button != INT_MIN) { 274 if (ic->scroll_button != INT_MIN) {
275 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_button(%d)", 275 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) scroll_set_button(%d)",
276 ic->identifier, ic->scroll_button); 276 ic->identifier, ic->scroll_button);
277 log_libinput_config_status(libinput_device_config_scroll_set_button( 277 log_libinput_config_status(libinput_device_config_scroll_set_button(
278 libinput_device, ic->scroll_button)); 278 libinput_device, ic->scroll_button));
279 } 279 }
280 if (ic->scroll_method != INT_MIN) { 280 if (ic->scroll_method != INT_MIN) {
281 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", 281 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
282 ic->identifier, ic->scroll_method); 282 ic->identifier, ic->scroll_method);
283 log_libinput_config_status(libinput_device_config_scroll_set_method( 283 log_libinput_config_status(libinput_device_config_scroll_set_method(
284 libinput_device, ic->scroll_method)); 284 libinput_device, ic->scroll_method));
285 } 285 }
286 if (ic->send_events != INT_MIN) { 286 if (ic->send_events != INT_MIN) {
287 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", 287 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
288 ic->identifier, ic->send_events); 288 ic->identifier, ic->send_events);
289 log_libinput_config_status(libinput_device_config_send_events_set_mode( 289 log_libinput_config_status(libinput_device_config_send_events_set_mode(
290 libinput_device, ic->send_events)); 290 libinput_device, ic->send_events));
291 } 291 }
292 if (ic->tap != INT_MIN) { 292 if (ic->tap != INT_MIN) {
293 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", 293 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
294 ic->identifier, ic->tap); 294 ic->identifier, ic->tap);
295 log_libinput_config_status(libinput_device_config_tap_set_enabled( 295 log_libinput_config_status(libinput_device_config_tap_set_enabled(
296 libinput_device, ic->tap)); 296 libinput_device, ic->tap));
297 } 297 }
298 if (ic->tap_button_map != INT_MIN) { 298 if (ic->tap_button_map != INT_MIN) {
299 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_button_map(%d)", 299 sway_log(SWAY_DEBUG, "libinput_config_pointer(%s) tap_set_button_map(%d)",
300 ic->identifier, ic->tap_button_map); 300 ic->identifier, ic->tap_button_map);
301 log_libinput_config_status(libinput_device_config_tap_set_button_map( 301 log_libinput_config_status(libinput_device_config_tap_set_button_map(
302 libinput_device, ic->tap_button_map)); 302 libinput_device, ic->tap_button_map));
@@ -316,21 +316,21 @@ static void input_manager_libinput_reset_pointer(
316 316
317 enum libinput_config_accel_profile accel_profile = 317 enum libinput_config_accel_profile accel_profile =
318 libinput_device_config_accel_get_default_profile(libinput_device); 318 libinput_device_config_accel_get_default_profile(libinput_device);
319 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)", 319 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)",
320 input_device->identifier, accel_profile); 320 input_device->identifier, accel_profile);
321 log_libinput_config_status(libinput_device_config_accel_set_profile( 321 log_libinput_config_status(libinput_device_config_accel_set_profile(
322 libinput_device, accel_profile)); 322 libinput_device, accel_profile));
323 323
324 enum libinput_config_click_method click_method = 324 enum libinput_config_click_method click_method =
325 libinput_device_config_click_get_default_method(libinput_device); 325 libinput_device_config_click_get_default_method(libinput_device);
326 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)", 326 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)",
327 input_device->identifier, click_method); 327 input_device->identifier, click_method);
328 log_libinput_config_status(libinput_device_config_click_set_method( 328 log_libinput_config_status(libinput_device_config_click_set_method(
329 libinput_device, click_method)); 329 libinput_device, click_method));
330 330
331 enum libinput_config_drag_state drag = 331 enum libinput_config_drag_state drag =
332 libinput_device_config_tap_get_default_drag_enabled(libinput_device); 332 libinput_device_config_tap_get_default_drag_enabled(libinput_device);
333 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)", 333 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)",
334 input_device->identifier, drag); 334 input_device->identifier, drag);
335 log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( 335 log_libinput_config_status(libinput_device_config_tap_set_drag_enabled(
336 libinput_device, drag)); 336 libinput_device, drag));
@@ -338,7 +338,7 @@ static void input_manager_libinput_reset_pointer(
338 enum libinput_config_drag_lock_state drag_lock = 338 enum libinput_config_drag_lock_state drag_lock =
339 libinput_device_config_tap_get_default_drag_lock_enabled( 339 libinput_device_config_tap_get_default_drag_lock_enabled(
340 libinput_device); 340 libinput_device);
341 wlr_log(WLR_DEBUG, 341 sway_log(SWAY_DEBUG,
342 "libinput_reset_pointer(%s) tap_set_drag_lock_enabled(%d)", 342 "libinput_reset_pointer(%s) tap_set_drag_lock_enabled(%d)",
343 input_device->identifier, drag_lock); 343 input_device->identifier, drag_lock);
344 log_libinput_config_status( 344 log_libinput_config_status(
@@ -347,14 +347,14 @@ static void input_manager_libinput_reset_pointer(
347 347
348 enum libinput_config_dwt_state dwt = 348 enum libinput_config_dwt_state dwt =
349 libinput_device_config_dwt_get_default_enabled(libinput_device); 349 libinput_device_config_dwt_get_default_enabled(libinput_device);
350 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)", 350 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)",
351 input_device->identifier, dwt); 351 input_device->identifier, dwt);
352 log_libinput_config_status(libinput_device_config_dwt_set_enabled( 352 log_libinput_config_status(libinput_device_config_dwt_set_enabled(
353 libinput_device, dwt)); 353 libinput_device, dwt));
354 354
355 int left_handed = 355 int left_handed =
356 libinput_device_config_left_handed_get_default(libinput_device); 356 libinput_device_config_left_handed_get_default(libinput_device);
357 wlr_log(WLR_DEBUG, 357 sway_log(SWAY_DEBUG,
358 "libinput_reset_pointer(%s) left_handed_set_enabled(%d)", 358 "libinput_reset_pointer(%s) left_handed_set_enabled(%d)",
359 input_device->identifier, left_handed); 359 input_device->identifier, left_handed);
360 log_libinput_config_status(libinput_device_config_left_handed_set( 360 log_libinput_config_status(libinput_device_config_left_handed_set(
@@ -363,7 +363,7 @@ static void input_manager_libinput_reset_pointer(
363 enum libinput_config_middle_emulation_state middle_emulation = 363 enum libinput_config_middle_emulation_state middle_emulation =
364 libinput_device_config_middle_emulation_get_default_enabled( 364 libinput_device_config_middle_emulation_get_default_enabled(
365 libinput_device); 365 libinput_device);
366 wlr_log(WLR_DEBUG, 366 sway_log(SWAY_DEBUG,
367 "libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)", 367 "libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)",
368 input_device->identifier, middle_emulation); 368 input_device->identifier, middle_emulation);
369 log_libinput_config_status( 369 log_libinput_config_status(
@@ -373,7 +373,7 @@ static void input_manager_libinput_reset_pointer(
373 int natural_scroll = 373 int natural_scroll =
374 libinput_device_config_scroll_get_default_natural_scroll_enabled( 374 libinput_device_config_scroll_get_default_natural_scroll_enabled(
375 libinput_device); 375 libinput_device);
376 wlr_log(WLR_DEBUG, 376 sway_log(SWAY_DEBUG,
377 "libinput_reset_pointer(%s) natural_scroll_set_enabled(%d)", 377 "libinput_reset_pointer(%s) natural_scroll_set_enabled(%d)",
378 input_device->identifier, natural_scroll); 378 input_device->identifier, natural_scroll);
379 log_libinput_config_status( 379 log_libinput_config_status(
@@ -382,42 +382,42 @@ static void input_manager_libinput_reset_pointer(
382 382
383 double pointer_accel = 383 double pointer_accel =
384 libinput_device_config_accel_get_default_speed(libinput_device); 384 libinput_device_config_accel_get_default_speed(libinput_device);
385 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)", 385 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)",
386 input_device->identifier, pointer_accel); 386 input_device->identifier, pointer_accel);
387 log_libinput_config_status(libinput_device_config_accel_set_speed( 387 log_libinput_config_status(libinput_device_config_accel_set_speed(
388 libinput_device, pointer_accel)); 388 libinput_device, pointer_accel));
389 389
390 uint32_t scroll_button = 390 uint32_t scroll_button =
391 libinput_device_config_scroll_get_default_button(libinput_device); 391 libinput_device_config_scroll_get_default_button(libinput_device);
392 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)", 392 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)",
393 input_device->identifier, scroll_button); 393 input_device->identifier, scroll_button);
394 log_libinput_config_status(libinput_device_config_scroll_set_button( 394 log_libinput_config_status(libinput_device_config_scroll_set_button(
395 libinput_device, scroll_button)); 395 libinput_device, scroll_button));
396 396
397 enum libinput_config_scroll_method scroll_method = 397 enum libinput_config_scroll_method scroll_method =
398 libinput_device_config_scroll_get_default_method(libinput_device); 398 libinput_device_config_scroll_get_default_method(libinput_device);
399 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)", 399 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)",
400 input_device->identifier, scroll_method); 400 input_device->identifier, scroll_method);
401 log_libinput_config_status(libinput_device_config_scroll_set_method( 401 log_libinput_config_status(libinput_device_config_scroll_set_method(
402 libinput_device, scroll_method)); 402 libinput_device, scroll_method));
403 403
404 uint32_t send_events = 404 uint32_t send_events =
405 libinput_device_config_send_events_get_default_mode(libinput_device); 405 libinput_device_config_send_events_get_default_mode(libinput_device);
406 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)", 406 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)",
407 input_device->identifier, send_events); 407 input_device->identifier, send_events);
408 log_libinput_config_status(libinput_device_config_send_events_set_mode( 408 log_libinput_config_status(libinput_device_config_send_events_set_mode(
409 libinput_device, send_events)); 409 libinput_device, send_events));
410 410
411 enum libinput_config_tap_state tap = 411 enum libinput_config_tap_state tap =
412 libinput_device_config_tap_get_default_enabled(libinput_device); 412 libinput_device_config_tap_get_default_enabled(libinput_device);
413 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)", 413 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)",
414 input_device->identifier, tap); 414 input_device->identifier, tap);
415 log_libinput_config_status(libinput_device_config_tap_set_enabled( 415 log_libinput_config_status(libinput_device_config_tap_set_enabled(
416 libinput_device, tap)); 416 libinput_device, tap));
417 417
418 enum libinput_config_tap_button_map tap_button_map = 418 enum libinput_config_tap_button_map tap_button_map =
419 libinput_device_config_tap_get_button_map(libinput_device); 419 libinput_device_config_tap_get_button_map(libinput_device);
420 wlr_log(WLR_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)", 420 sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)",
421 input_device->identifier, tap_button_map); 421 input_device->identifier, tap_button_map);
422 log_libinput_config_status(libinput_device_config_tap_set_button_map( 422 log_libinput_config_status(libinput_device_config_tap_set_button_map(
423 libinput_device, tap_button_map)); 423 libinput_device, tap_button_map));
@@ -432,7 +432,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
432 return; 432 return;
433 } 433 }
434 434
435 wlr_log(WLR_DEBUG, "removing device: '%s'", 435 sway_log(SWAY_DEBUG, "removing device: '%s'",
436 input_device->identifier); 436 input_device->identifier);
437 437
438 struct sway_seat *seat = NULL; 438 struct sway_seat *seat = NULL;
@@ -462,7 +462,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
462 input_device->identifier = input_device_get_identifier(device); 462 input_device->identifier = input_device_get_identifier(device);
463 wl_list_insert(&input->devices, &input_device->link); 463 wl_list_insert(&input->devices, &input_device->link);
464 464
465 wlr_log(WLR_DEBUG, "adding device: '%s'", 465 sway_log(SWAY_DEBUG, "adding device: '%s'",
466 input_device->identifier); 466 input_device->identifier);
467 467
468 if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER || 468 if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER ||
@@ -504,7 +504,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
504 } 504 }
505 505
506 if (!added) { 506 if (!added) {
507 wlr_log(WLR_DEBUG, 507 sway_log(SWAY_DEBUG,
508 "device '%s' is not configured on any seats", 508 "device '%s' is not configured on any seats",
509 input_device->identifier); 509 input_device->identifier);
510 } 510 }
@@ -554,7 +554,7 @@ void handle_virtual_keyboard(struct wl_listener *listener, void *data) {
554 input_device->identifier = input_device_get_identifier(device); 554 input_device->identifier = input_device_get_identifier(device);
555 wl_list_insert(&input_manager->devices, &input_device->link); 555 wl_list_insert(&input_manager->devices, &input_device->link);
556 556
557 wlr_log(WLR_DEBUG, "adding virtual keyboard: '%s'", 557 sway_log(SWAY_DEBUG, "adding virtual keyboard: '%s'",
558 input_device->identifier); 558 input_device->identifier);
559 559
560 wl_signal_add(&device->events.destroy, &input_device->device_destroy); 560 wl_signal_add(&device->events.destroy, &input_device->device_destroy);
@@ -660,7 +660,7 @@ void input_manager_reset_all_inputs() {
660 660
661 661
662void input_manager_apply_seat_config(struct seat_config *seat_config) { 662void input_manager_apply_seat_config(struct seat_config *seat_config) {
663 wlr_log(WLR_DEBUG, "applying seat config for seat %s", seat_config->name); 663 sway_log(SWAY_DEBUG, "applying seat config for seat %s", seat_config->name);
664 if (strcmp(seat_config->name, "*") == 0) { 664 if (strcmp(seat_config->name, "*") == 0) {
665 struct sway_seat *seat = NULL; 665 struct sway_seat *seat = NULL;
666 wl_list_for_each(seat, &server.input->seats, link) { 666 wl_list_for_each(seat, &server.input->seats, link) {
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 2ea796a9..c1fc60f7 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -126,7 +126,7 @@ static void get_active_binding(const struct sway_shortcut_state *state,
126 126
127 if (*current_binding && *current_binding != binding && 127 if (*current_binding && *current_binding != binding &&
128 strcmp((*current_binding)->input, binding->input) == 0) { 128 strcmp((*current_binding)->input, binding->input) == 0) {
129 wlr_log(WLR_DEBUG, "encountered duplicate bindings %d and %d", 129 sway_log(SWAY_DEBUG, "encountered duplicate bindings %d and %d",
130 (*current_binding)->order, binding->order); 130 (*current_binding)->order, binding->order);
131 } else if (!*current_binding || 131 } else if (!*current_binding ||
132 strcmp((*current_binding)->input, "*") == 0) { 132 strcmp((*current_binding)->input, "*") == 0) {
@@ -219,7 +219,7 @@ void sway_keyboard_disarm_key_repeat(struct sway_keyboard *keyboard) {
219 } 219 }
220 keyboard->repeat_binding = NULL; 220 keyboard->repeat_binding = NULL;
221 if (wl_event_source_timer_update(keyboard->key_repeat_source, 0) < 0) { 221 if (wl_event_source_timer_update(keyboard->key_repeat_source, 0) < 0) {
222 wlr_log(WLR_DEBUG, "failed to disarm key repeat timer"); 222 sway_log(SWAY_DEBUG, "failed to disarm key repeat timer");
223 } 223 }
224} 224}
225 225
@@ -313,7 +313,7 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
313 keyboard->repeat_binding = binding; 313 keyboard->repeat_binding = binding;
314 if (wl_event_source_timer_update(keyboard->key_repeat_source, 314 if (wl_event_source_timer_update(keyboard->key_repeat_source,
315 wlr_device->keyboard->repeat_info.delay) < 0) { 315 wlr_device->keyboard->repeat_info.delay) < 0) {
316 wlr_log(WLR_DEBUG, "failed to set key repeat timer"); 316 sway_log(SWAY_DEBUG, "failed to set key repeat timer");
317 } 317 }
318 } else if (keyboard->repeat_binding) { 318 } else if (keyboard->repeat_binding) {
319 sway_keyboard_disarm_key_repeat(keyboard); 319 sway_keyboard_disarm_key_repeat(keyboard);
@@ -356,7 +356,7 @@ static int handle_keyboard_repeat(void *data) {
356 // We queue the next event first, as the command might cancel it 356 // We queue the next event first, as the command might cancel it
357 if (wl_event_source_timer_update(keyboard->key_repeat_source, 357 if (wl_event_source_timer_update(keyboard->key_repeat_source,
358 1000 / wlr_device->repeat_info.rate) < 0) { 358 1000 / wlr_device->repeat_info.rate) < 0) {
359 wlr_log(WLR_DEBUG, "failed to update key repeat timer"); 359 sway_log(SWAY_DEBUG, "failed to update key repeat timer");
360 } 360 }
361 } 361 }
362 362
@@ -460,7 +460,7 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
460 xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); 460 xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
461 461
462 if (!keymap) { 462 if (!keymap) {
463 wlr_log(WLR_DEBUG, "cannot configure keyboard: keymap does not exist"); 463 sway_log(SWAY_DEBUG, "cannot configure keyboard: keymap does not exist");
464 xkb_context_unref(context); 464 xkb_context_unref(context);
465 return; 465 return;
466 } 466 }
diff --git a/sway/input/seat.c b/sway/input/seat.c
index a66a8198..82e0e754 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -62,7 +62,7 @@ static void seat_node_destroy(struct sway_seat_node *seat_node) {
62static void seat_send_activate(struct sway_node *node, struct sway_seat *seat) { 62static void seat_send_activate(struct sway_node *node, struct sway_seat *seat) {
63 if (node_is_view(node)) { 63 if (node_is_view(node)) {
64 if (!seat_is_input_allowed(seat, node->sway_container->view->surface)) { 64 if (!seat_is_input_allowed(seat, node->sway_container->view->surface)) {
65 wlr_log(WLR_DEBUG, "Refusing to set focus, input is inhibited"); 65 sway_log(SWAY_DEBUG, "Refusing to set focus, input is inhibited");
66 return; 66 return;
67 } 67 }
68 view_set_activated(node->sway_container->view, true); 68 view_set_activated(node->sway_container->view, true);
@@ -208,7 +208,7 @@ static struct sway_seat_node *seat_node_from_node(
208 208
209 seat_node = calloc(1, sizeof(struct sway_seat_node)); 209 seat_node = calloc(1, sizeof(struct sway_seat_node));
210 if (seat_node == NULL) { 210 if (seat_node == NULL) {
211 wlr_log(WLR_ERROR, "could not allocate seat node"); 211 sway_log(SWAY_ERROR, "could not allocate seat node");
212 return NULL; 212 return NULL;
213 } 213 }
214 214
@@ -289,7 +289,7 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) {
289 289
290 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon)); 290 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon));
291 if (icon == NULL) { 291 if (icon == NULL) {
292 wlr_log(WLR_ERROR, "Allocation failed"); 292 sway_log(SWAY_ERROR, "Allocation failed");
293 return; 293 return;
294 } 294 }
295 icon->seat = seat; 295 icon->seat = seat;
@@ -407,7 +407,7 @@ static void seat_update_capabilities(struct sway_seat *seat) {
407 407
408static void seat_reset_input_config(struct sway_seat *seat, 408static void seat_reset_input_config(struct sway_seat *seat,
409 struct sway_seat_device *sway_device) { 409 struct sway_seat_device *sway_device) {
410 wlr_log(WLR_DEBUG, "Resetting output mapping for input device %s", 410 sway_log(SWAY_DEBUG, "Resetting output mapping for input device %s",
411 sway_device->input_device->identifier); 411 sway_device->input_device->identifier);
412 wlr_cursor_map_input_to_output(seat->cursor->cursor, 412 wlr_cursor_map_input_to_output(seat->cursor->cursor,
413 sway_device->input_device->wlr_device, NULL); 413 sway_device->input_device->wlr_device, NULL);
@@ -420,7 +420,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
420 struct input_config *ic = input_device_get_config( 420 struct input_config *ic = input_device_get_config(
421 sway_device->input_device); 421 sway_device->input_device);
422 if (ic != NULL) { 422 if (ic != NULL) {
423 wlr_log(WLR_DEBUG, "Applying input config to %s", 423 sway_log(SWAY_DEBUG, "Applying input config to %s",
424 sway_device->input_device->identifier); 424 sway_device->input_device->identifier);
425 425
426 mapped_to_output = ic->mapped_to_output; 426 mapped_to_output = ic->mapped_to_output;
@@ -430,19 +430,19 @@ static void seat_apply_input_config(struct sway_seat *seat,
430 mapped_to_output = sway_device->input_device->wlr_device->output_name; 430 mapped_to_output = sway_device->input_device->wlr_device->output_name;
431 } 431 }
432 if (mapped_to_output != NULL) { 432 if (mapped_to_output != NULL) {
433 wlr_log(WLR_DEBUG, "Mapping input device %s to output %s", 433 sway_log(SWAY_DEBUG, "Mapping input device %s to output %s",
434 sway_device->input_device->identifier, mapped_to_output); 434 sway_device->input_device->identifier, mapped_to_output);
435 if (strcmp("*", mapped_to_output) == 0) { 435 if (strcmp("*", mapped_to_output) == 0) {
436 wlr_cursor_map_input_to_output(seat->cursor->cursor, 436 wlr_cursor_map_input_to_output(seat->cursor->cursor,
437 sway_device->input_device->wlr_device, NULL); 437 sway_device->input_device->wlr_device, NULL);
438 wlr_log(WLR_DEBUG, "Reset output mapping"); 438 sway_log(SWAY_DEBUG, "Reset output mapping");
439 return; 439 return;
440 } 440 }
441 struct sway_output *output = output_by_name_or_id(mapped_to_output); 441 struct sway_output *output = output_by_name_or_id(mapped_to_output);
442 if (output) { 442 if (output) {
443 wlr_cursor_map_input_to_output(seat->cursor->cursor, 443 wlr_cursor_map_input_to_output(seat->cursor->cursor,
444 sway_device->input_device->wlr_device, output->wlr_output); 444 sway_device->input_device->wlr_device, output->wlr_output);
445 wlr_log(WLR_DEBUG, "Mapped to output %s", output->wlr_output->name); 445 sway_log(SWAY_DEBUG, "Mapped to output %s", output->wlr_output->name);
446 } 446 }
447 } 447 }
448} 448}
@@ -522,10 +522,10 @@ void seat_configure_device(struct sway_seat *seat,
522 seat_configure_tablet_tool(seat, seat_device); 522 seat_configure_tablet_tool(seat, seat_device);
523 break; 523 break;
524 case WLR_INPUT_DEVICE_TABLET_PAD: 524 case WLR_INPUT_DEVICE_TABLET_PAD:
525 wlr_log(WLR_DEBUG, "TODO: configure tablet pad"); 525 sway_log(SWAY_DEBUG, "TODO: configure tablet pad");
526 break; 526 break;
527 case WLR_INPUT_DEVICE_SWITCH: 527 case WLR_INPUT_DEVICE_SWITCH:
528 wlr_log(WLR_DEBUG, "TODO: configure switch device"); 528 sway_log(SWAY_DEBUG, "TODO: configure switch device");
529 break; 529 break;
530 } 530 }
531} 531}
@@ -552,10 +552,10 @@ void seat_reset_device(struct sway_seat *seat,
552 seat_reset_input_config(seat, seat_device); 552 seat_reset_input_config(seat, seat_device);
553 break; 553 break;
554 case WLR_INPUT_DEVICE_TABLET_PAD: 554 case WLR_INPUT_DEVICE_TABLET_PAD:
555 wlr_log(WLR_DEBUG, "TODO: reset tablet pad"); 555 sway_log(SWAY_DEBUG, "TODO: reset tablet pad");
556 break; 556 break;
557 case WLR_INPUT_DEVICE_SWITCH: 557 case WLR_INPUT_DEVICE_SWITCH:
558 wlr_log(WLR_DEBUG, "TODO: reset switch device"); 558 sway_log(SWAY_DEBUG, "TODO: reset switch device");
559 break; 559 break;
560 } 560 }
561} 561}
@@ -570,11 +570,11 @@ void seat_add_device(struct sway_seat *seat,
570 struct sway_seat_device *seat_device = 570 struct sway_seat_device *seat_device =
571 calloc(1, sizeof(struct sway_seat_device)); 571 calloc(1, sizeof(struct sway_seat_device));
572 if (!seat_device) { 572 if (!seat_device) {
573 wlr_log(WLR_DEBUG, "could not allocate seat device"); 573 sway_log(SWAY_DEBUG, "could not allocate seat device");
574 return; 574 return;
575 } 575 }
576 576
577 wlr_log(WLR_DEBUG, "adding device %s to seat %s", 577 sway_log(SWAY_DEBUG, "adding device %s to seat %s",
578 input_device->identifier, seat->wlr_seat->name); 578 input_device->identifier, seat->wlr_seat->name);
579 579
580 seat_device->sway_seat = seat; 580 seat_device->sway_seat = seat;
@@ -594,7 +594,7 @@ void seat_remove_device(struct sway_seat *seat,
594 return; 594 return;
595 } 595 }
596 596
597 wlr_log(WLR_DEBUG, "removing device %s from seat %s", 597 sway_log(SWAY_DEBUG, "removing device %s from seat %s",
598 input_device->identifier, seat->wlr_seat->name); 598 input_device->identifier, seat->wlr_seat->name);
599 599
600 seat_device_destroy(seat_device); 600 seat_device_destroy(seat_device);
@@ -790,7 +790,7 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
790 wl_event_source_timer_update(view->urgent_timer, 790 wl_event_source_timer_update(view->urgent_timer,
791 config->urgent_timeout); 791 config->urgent_timeout);
792 } else { 792 } else {
793 wlr_log(WLR_ERROR, "Unable to create urgency timer (%s)", 793 sway_log(SWAY_ERROR, "Unable to create urgency timer (%s)",
794 strerror(errno)); 794 strerror(errno));
795 handle_urgent_timeout(view); 795 handle_urgent_timeout(view);
796 } 796 }
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 9a033a4b..82e144b7 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -147,32 +147,32 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
147int ipc_handle_connection(int fd, uint32_t mask, void *data) { 147int ipc_handle_connection(int fd, uint32_t mask, void *data) {
148 (void) fd; 148 (void) fd;
149 struct sway_server *server = data; 149 struct sway_server *server = data;
150 wlr_log(WLR_DEBUG, "Event on IPC listening socket"); 150 sway_log(SWAY_DEBUG, "Event on IPC listening socket");
151 assert(mask == WL_EVENT_READABLE); 151 assert(mask == WL_EVENT_READABLE);
152 152
153 int client_fd = accept(ipc_socket, NULL, NULL); 153 int client_fd = accept(ipc_socket, NULL, NULL);
154 if (client_fd == -1) { 154 if (client_fd == -1) {
155 wlr_log_errno(WLR_ERROR, "Unable to accept IPC client connection"); 155 sway_log_errno(SWAY_ERROR, "Unable to accept IPC client connection");
156 return 0; 156 return 0;
157 } 157 }
158 158
159 int flags; 159 int flags;
160 if ((flags = fcntl(client_fd, F_GETFD)) == -1 160 if ((flags = fcntl(client_fd, F_GETFD)) == -1
161 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { 161 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
162 wlr_log_errno(WLR_ERROR, "Unable to set CLOEXEC on IPC client socket"); 162 sway_log_errno(SWAY_ERROR, "Unable to set CLOEXEC on IPC client socket");
163 close(client_fd); 163 close(client_fd);
164 return 0; 164 return 0;
165 } 165 }
166 if ((flags = fcntl(client_fd, F_GETFL)) == -1 166 if ((flags = fcntl(client_fd, F_GETFL)) == -1
167 || fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) { 167 || fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) {
168 wlr_log_errno(WLR_ERROR, "Unable to set NONBLOCK on IPC client socket"); 168 sway_log_errno(SWAY_ERROR, "Unable to set NONBLOCK on IPC client socket");
169 close(client_fd); 169 close(client_fd);
170 return 0; 170 return 0;
171 } 171 }
172 172
173 struct ipc_client *client = malloc(sizeof(struct ipc_client)); 173 struct ipc_client *client = malloc(sizeof(struct ipc_client));
174 if (!client) { 174 if (!client) {
175 wlr_log(WLR_ERROR, "Unable to allocate ipc client"); 175 sway_log(SWAY_ERROR, "Unable to allocate ipc client");
176 close(client_fd); 176 close(client_fd);
177 return 0; 177 return 0;
178 } 178 }
@@ -188,12 +188,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
188 client->write_buffer_len = 0; 188 client->write_buffer_len = 0;
189 client->write_buffer = malloc(client->write_buffer_size); 189 client->write_buffer = malloc(client->write_buffer_size);
190 if (!client->write_buffer) { 190 if (!client->write_buffer) {
191 wlr_log(WLR_ERROR, "Unable to allocate ipc client write buffer"); 191 sway_log(SWAY_ERROR, "Unable to allocate ipc client write buffer");
192 close(client_fd); 192 close(client_fd);
193 return 0; 193 return 0;
194 } 194 }
195 195
196 wlr_log(WLR_DEBUG, "New client: fd %d", client_fd); 196 sway_log(SWAY_DEBUG, "New client: fd %d", client_fd);
197 list_add(ipc_client_list, client); 197 list_add(ipc_client_list, client);
198 return 0; 198 return 0;
199} 199}
@@ -202,22 +202,22 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
202 struct ipc_client *client = data; 202 struct ipc_client *client = data;
203 203
204 if (mask & WL_EVENT_ERROR) { 204 if (mask & WL_EVENT_ERROR) {
205 wlr_log(WLR_ERROR, "IPC Client socket error, removing client"); 205 sway_log(SWAY_ERROR, "IPC Client socket error, removing client");
206 ipc_client_disconnect(client); 206 ipc_client_disconnect(client);
207 return 0; 207 return 0;
208 } 208 }
209 209
210 if (mask & WL_EVENT_HANGUP) { 210 if (mask & WL_EVENT_HANGUP) {
211 wlr_log(WLR_DEBUG, "Client %d hung up", client->fd); 211 sway_log(SWAY_DEBUG, "Client %d hung up", client->fd);
212 ipc_client_disconnect(client); 212 ipc_client_disconnect(client);
213 return 0; 213 return 0;
214 } 214 }
215 215
216 wlr_log(WLR_DEBUG, "Client %d readable", client->fd); 216 sway_log(SWAY_DEBUG, "Client %d readable", client->fd);
217 217
218 int read_available; 218 int read_available;
219 if (ioctl(client_fd, FIONREAD, &read_available) == -1) { 219 if (ioctl(client_fd, FIONREAD, &read_available) == -1) {
220 wlr_log_errno(WLR_INFO, "Unable to read IPC socket buffer size"); 220 sway_log_errno(SWAY_INFO, "Unable to read IPC socket buffer size");
221 ipc_client_disconnect(client); 221 ipc_client_disconnect(client);
222 return 0; 222 return 0;
223 } 223 }
@@ -239,13 +239,13 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
239 // Should be fully available, because read_available >= IPC_HEADER_SIZE 239 // Should be fully available, because read_available >= IPC_HEADER_SIZE
240 ssize_t received = recv(client_fd, buf, IPC_HEADER_SIZE, 0); 240 ssize_t received = recv(client_fd, buf, IPC_HEADER_SIZE, 0);
241 if (received == -1) { 241 if (received == -1) {
242 wlr_log_errno(WLR_INFO, "Unable to receive header from IPC client"); 242 sway_log_errno(SWAY_INFO, "Unable to receive header from IPC client");
243 ipc_client_disconnect(client); 243 ipc_client_disconnect(client);
244 return 0; 244 return 0;
245 } 245 }
246 246
247 if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) { 247 if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) {
248 wlr_log(WLR_DEBUG, "IPC header check failed"); 248 sway_log(SWAY_DEBUG, "IPC header check failed");
249 ipc_client_disconnect(client); 249 ipc_client_disconnect(client);
250 return 0; 250 return 0;
251 } 251 }
@@ -279,7 +279,7 @@ static void ipc_send_event(const char *json_string, enum ipc_command_type event)
279 } 279 }
280 client->current_command = event; 280 client->current_command = event;
281 if (!ipc_send_reply(client, json_string, (uint32_t) strlen(json_string))) { 281 if (!ipc_send_reply(client, json_string, (uint32_t) strlen(json_string))) {
282 wlr_log_errno(WLR_INFO, "Unable to send reply to IPC client"); 282 sway_log_errno(SWAY_INFO, "Unable to send reply to IPC client");
283 /* ipc_send_reply destroys client on error, which also 283 /* ipc_send_reply destroys client on error, which also
284 * removes it from the list, so we need to process 284 * removes it from the list, so we need to process
285 * current index again */ 285 * current index again */
@@ -293,7 +293,7 @@ void ipc_event_workspace(struct sway_workspace *old,
293 if (!ipc_has_event_listeners(IPC_EVENT_WORKSPACE)) { 293 if (!ipc_has_event_listeners(IPC_EVENT_WORKSPACE)) {
294 return; 294 return;
295 } 295 }
296 wlr_log(WLR_DEBUG, "Sending workspace::%s event", change); 296 sway_log(SWAY_DEBUG, "Sending workspace::%s event", change);
297 json_object *obj = json_object_new_object(); 297 json_object *obj = json_object_new_object();
298 json_object_object_add(obj, "change", json_object_new_string(change)); 298 json_object_object_add(obj, "change", json_object_new_string(change));
299 if (old) { 299 if (old) {
@@ -319,7 +319,7 @@ void ipc_event_window(struct sway_container *window, const char *change) {
319 if (!ipc_has_event_listeners(IPC_EVENT_WINDOW)) { 319 if (!ipc_has_event_listeners(IPC_EVENT_WINDOW)) {
320 return; 320 return;
321 } 321 }
322 wlr_log(WLR_DEBUG, "Sending window::%s event", change); 322 sway_log(SWAY_DEBUG, "Sending window::%s event", change);
323 json_object *obj = json_object_new_object(); 323 json_object *obj = json_object_new_object();
324 json_object_object_add(obj, "change", json_object_new_string(change)); 324 json_object_object_add(obj, "change", json_object_new_string(change));
325 json_object_object_add(obj, "container", 325 json_object_object_add(obj, "container",
@@ -334,7 +334,7 @@ void ipc_event_barconfig_update(struct bar_config *bar) {
334 if (!ipc_has_event_listeners(IPC_EVENT_BARCONFIG_UPDATE)) { 334 if (!ipc_has_event_listeners(IPC_EVENT_BARCONFIG_UPDATE)) {
335 return; 335 return;
336 } 336 }
337 wlr_log(WLR_DEBUG, "Sending barconfig_update event"); 337 sway_log(SWAY_DEBUG, "Sending barconfig_update event");
338 json_object *json = ipc_json_describe_bar_config(bar); 338 json_object *json = ipc_json_describe_bar_config(bar);
339 339
340 const char *json_string = json_object_to_json_string(json); 340 const char *json_string = json_object_to_json_string(json);
@@ -346,7 +346,7 @@ void ipc_event_bar_state_update(struct bar_config *bar) {
346 if (!ipc_has_event_listeners(IPC_EVENT_BAR_STATE_UPDATE)) { 346 if (!ipc_has_event_listeners(IPC_EVENT_BAR_STATE_UPDATE)) {
347 return; 347 return;
348 } 348 }
349 wlr_log(WLR_DEBUG, "Sending bar_state_update event"); 349 sway_log(SWAY_DEBUG, "Sending bar_state_update event");
350 350
351 json_object *json = json_object_new_object(); 351 json_object *json = json_object_new_object();
352 json_object_object_add(json, "id", json_object_new_string(bar->id)); 352 json_object_object_add(json, "id", json_object_new_string(bar->id));
@@ -362,7 +362,7 @@ void ipc_event_mode(const char *mode, bool pango) {
362 if (!ipc_has_event_listeners(IPC_EVENT_MODE)) { 362 if (!ipc_has_event_listeners(IPC_EVENT_MODE)) {
363 return; 363 return;
364 } 364 }
365 wlr_log(WLR_DEBUG, "Sending mode::%s event", mode); 365 sway_log(SWAY_DEBUG, "Sending mode::%s event", mode);
366 json_object *obj = json_object_new_object(); 366 json_object *obj = json_object_new_object();
367 json_object_object_add(obj, "change", json_object_new_string(mode)); 367 json_object_object_add(obj, "change", json_object_new_string(mode));
368 json_object_object_add(obj, "pango_markup", 368 json_object_object_add(obj, "pango_markup",
@@ -377,7 +377,7 @@ void ipc_event_shutdown(const char *reason) {
377 if (!ipc_has_event_listeners(IPC_EVENT_SHUTDOWN)) { 377 if (!ipc_has_event_listeners(IPC_EVENT_SHUTDOWN)) {
378 return; 378 return;
379 } 379 }
380 wlr_log(WLR_DEBUG, "Sending shutdown::%s event", reason); 380 sway_log(SWAY_DEBUG, "Sending shutdown::%s event", reason);
381 381
382 json_object *json = json_object_new_object(); 382 json_object *json = json_object_new_object();
383 json_object_object_add(json, "change", json_object_new_string(reason)); 383 json_object_object_add(json, "change", json_object_new_string(reason));
@@ -391,7 +391,7 @@ void ipc_event_binding(struct sway_binding *binding) {
391 if (!ipc_has_event_listeners(IPC_EVENT_BINDING)) { 391 if (!ipc_has_event_listeners(IPC_EVENT_BINDING)) {
392 return; 392 return;
393 } 393 }
394 wlr_log(WLR_DEBUG, "Sending binding event"); 394 sway_log(SWAY_DEBUG, "Sending binding event");
395 395
396 json_object *json_binding = json_object_new_object(); 396 json_object *json_binding = json_object_new_object();
397 json_object_object_add(json_binding, "command", json_object_new_string(binding->command)); 397 json_object_object_add(json_binding, "command", json_object_new_string(binding->command));
@@ -464,7 +464,7 @@ static void ipc_event_tick(const char *payload) {
464 if (!ipc_has_event_listeners(IPC_EVENT_TICK)) { 464 if (!ipc_has_event_listeners(IPC_EVENT_TICK)) {
465 return; 465 return;
466 } 466 }
467 wlr_log(WLR_DEBUG, "Sending tick event"); 467 sway_log(SWAY_DEBUG, "Sending tick event");
468 468
469 json_object *json = json_object_new_object(); 469 json_object *json = json_object_new_object();
470 json_object_object_add(json, "first", json_object_new_boolean(false)); 470 json_object_object_add(json, "first", json_object_new_boolean(false));
@@ -479,13 +479,13 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
479 struct ipc_client *client = data; 479 struct ipc_client *client = data;
480 480
481 if (mask & WL_EVENT_ERROR) { 481 if (mask & WL_EVENT_ERROR) {
482 wlr_log(WLR_ERROR, "IPC Client socket error, removing client"); 482 sway_log(SWAY_ERROR, "IPC Client socket error, removing client");
483 ipc_client_disconnect(client); 483 ipc_client_disconnect(client);
484 return 0; 484 return 0;
485 } 485 }
486 486
487 if (mask & WL_EVENT_HANGUP) { 487 if (mask & WL_EVENT_HANGUP) {
488 wlr_log(WLR_DEBUG, "Client %d hung up", client->fd); 488 sway_log(SWAY_DEBUG, "Client %d hung up", client->fd);
489 ipc_client_disconnect(client); 489 ipc_client_disconnect(client);
490 return 0; 490 return 0;
491 } 491 }
@@ -494,14 +494,14 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
494 return 0; 494 return 0;
495 } 495 }
496 496
497 wlr_log(WLR_DEBUG, "Client %d writable", client->fd); 497 sway_log(SWAY_DEBUG, "Client %d writable", client->fd);
498 498
499 ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len); 499 ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len);
500 500
501 if (written == -1 && errno == EAGAIN) { 501 if (written == -1 && errno == EAGAIN) {
502 return 0; 502 return 0;
503 } else if (written == -1) { 503 } else if (written == -1) {
504 wlr_log_errno(WLR_INFO, "Unable to send data from queue to IPC client"); 504 sway_log_errno(SWAY_INFO, "Unable to send data from queue to IPC client");
505 ipc_client_disconnect(client); 505 ipc_client_disconnect(client);
506 return 0; 506 return 0;
507 } 507 }
@@ -524,7 +524,7 @@ void ipc_client_disconnect(struct ipc_client *client) {
524 524
525 shutdown(client->fd, SHUT_RDWR); 525 shutdown(client->fd, SHUT_RDWR);
526 526
527 wlr_log(WLR_INFO, "IPC Client %d disconnected", client->fd); 527 sway_log(SWAY_INFO, "IPC Client %d disconnected", client->fd);
528 wl_event_source_remove(client->event_source); 528 wl_event_source_remove(client->event_source);
529 if (client->writable_event_source) { 529 if (client->writable_event_source) {
530 wl_event_source_remove(client->writable_event_source); 530 wl_event_source_remove(client->writable_event_source);
@@ -573,7 +573,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
573 573
574 char *buf = malloc(client->payload_length + 1); 574 char *buf = malloc(client->payload_length + 1);
575 if (!buf) { 575 if (!buf) {
576 wlr_log_errno(WLR_INFO, "Unable to allocate IPC payload"); 576 sway_log_errno(SWAY_INFO, "Unable to allocate IPC payload");
577 ipc_client_disconnect(client); 577 ipc_client_disconnect(client);
578 return; 578 return;
579 } 579 }
@@ -582,7 +582,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
582 ssize_t received = recv(client->fd, buf, client->payload_length, 0); 582 ssize_t received = recv(client->fd, buf, client->payload_length, 0);
583 if (received == -1) 583 if (received == -1)
584 { 584 {
585 wlr_log_errno(WLR_INFO, "Unable to receive payload from IPC client"); 585 sway_log_errno(SWAY_INFO, "Unable to receive payload from IPC client");
586 ipc_client_disconnect(client); 586 ipc_client_disconnect(client);
587 free(buf); 587 free(buf);
588 return; 588 return;
@@ -667,7 +667,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
667 if (request == NULL || !json_object_is_type(request, json_type_array)) { 667 if (request == NULL || !json_object_is_type(request, json_type_array)) {
668 const char msg[] = "{\"success\": false}"; 668 const char msg[] = "{\"success\": false}";
669 client_valid = ipc_send_reply(client, msg, strlen(msg)); 669 client_valid = ipc_send_reply(client, msg, strlen(msg));
670 wlr_log(WLR_INFO, "Failed to parse subscribe request"); 670 sway_log(SWAY_INFO, "Failed to parse subscribe request");
671 goto exit_cleanup; 671 goto exit_cleanup;
672 } 672 }
673 673
@@ -696,7 +696,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
696 const char msg[] = "{\"success\": false}"; 696 const char msg[] = "{\"success\": false}";
697 client_valid = ipc_send_reply(client, msg, strlen(msg)); 697 client_valid = ipc_send_reply(client, msg, strlen(msg));
698 json_object_put(request); 698 json_object_put(request);
699 wlr_log(WLR_INFO, "Unsupported event type in subscribe request"); 699 sway_log(SWAY_INFO, "Unsupported event type in subscribe request");
700 goto exit_cleanup; 700 goto exit_cleanup;
701 } 701 }
702 } 702 }
@@ -845,7 +845,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
845 } 845 }
846 846
847 default: 847 default:
848 wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command); 848 sway_log(SWAY_INFO, "Unknown IPC command type %i", client->current_command);
849 goto exit_cleanup; 849 goto exit_cleanup;
850 } 850 }
851 851
@@ -873,14 +873,14 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
873 } 873 }
874 874
875 if (client->write_buffer_size > 4e6) { // 4 MB 875 if (client->write_buffer_size > 4e6) { // 4 MB
876 wlr_log(WLR_ERROR, "Client write buffer too big, disconnecting client"); 876 sway_log(SWAY_ERROR, "Client write buffer too big, disconnecting client");
877 ipc_client_disconnect(client); 877 ipc_client_disconnect(client);
878 return false; 878 return false;
879 } 879 }
880 880
881 char *new_buffer = realloc(client->write_buffer, client->write_buffer_size); 881 char *new_buffer = realloc(client->write_buffer, client->write_buffer_size);
882 if (!new_buffer) { 882 if (!new_buffer) {
883 wlr_log(WLR_ERROR, "Unable to reallocate ipc client write buffer"); 883 sway_log(SWAY_ERROR, "Unable to reallocate ipc client write buffer");
884 ipc_client_disconnect(client); 884 ipc_client_disconnect(client);
885 return false; 885 return false;
886 } 886 }
@@ -897,6 +897,6 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
897 ipc_client_handle_writable, client); 897 ipc_client_handle_writable, client);
898 } 898 }
899 899
900 wlr_log(WLR_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload); 900 sway_log(SWAY_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload);
901 return true; 901 return true;
902} 902}
diff --git a/sway/main.c b/sway/main.c
index 6e2f16db..4a92b25a 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -94,10 +94,10 @@ void detect_proprietary(int allow_unsupported_gpu) {
94 while (getline(&line, &line_size, f) != -1) { 94 while (getline(&line, &line_size, f) != -1) {
95 if (strstr(line, "nvidia")) { 95 if (strstr(line, "nvidia")) {
96 if (allow_unsupported_gpu) { 96 if (allow_unsupported_gpu) {
97 wlr_log(WLR_ERROR, 97 sway_log(SWAY_ERROR,
98 "!!! Proprietary Nvidia drivers are in use !!!"); 98 "!!! Proprietary Nvidia drivers are in use !!!");
99 } else { 99 } else {
100 wlr_log(WLR_ERROR, 100 sway_log(SWAY_ERROR,
101 "Proprietary Nvidia drivers are NOT supported. " 101 "Proprietary Nvidia drivers are NOT supported. "
102 "Use Nouveau. To launch sway anyway, launch with " 102 "Use Nouveau. To launch sway anyway, launch with "
103 "--my-next-gpu-wont-be-nvidia and DO NOT report issues."); 103 "--my-next-gpu-wont-be-nvidia and DO NOT report issues.");
@@ -107,10 +107,10 @@ void detect_proprietary(int allow_unsupported_gpu) {
107 } 107 }
108 if (strstr(line, "fglrx")) { 108 if (strstr(line, "fglrx")) {
109 if (allow_unsupported_gpu) { 109 if (allow_unsupported_gpu) {
110 wlr_log(WLR_ERROR, 110 sway_log(SWAY_ERROR,
111 "!!! Proprietary AMD drivers are in use !!!"); 111 "!!! Proprietary AMD drivers are in use !!!");
112 } else { 112 } else {
113 wlr_log(WLR_ERROR, "Proprietary AMD drivers do NOT support " 113 sway_log(SWAY_ERROR, "Proprietary AMD drivers do NOT support "
114 "Wayland. Use radeon. To try anyway, launch sway with " 114 "Wayland. Use radeon. To try anyway, launch sway with "
115 "--unsupported-gpu and DO NOT report issues."); 115 "--unsupported-gpu and DO NOT report issues.");
116 exit(EXIT_FAILURE); 116 exit(EXIT_FAILURE);
@@ -141,7 +141,7 @@ static void log_env(void) {
141 "SWAYSOCK" 141 "SWAYSOCK"
142 }; 142 };
143 for (size_t i = 0; i < sizeof(log_vars) / sizeof(char *); ++i) { 143 for (size_t i = 0; i < sizeof(log_vars) / sizeof(char *); ++i) {
144 wlr_log(WLR_INFO, "%s=%s", log_vars[i], getenv(log_vars[i])); 144 sway_log(SWAY_INFO, "%s=%s", log_vars[i], getenv(log_vars[i]));
145 } 145 }
146} 146}
147 147
@@ -153,7 +153,7 @@ static void log_file(FILE *f) {
153 if (line[nread - 1] == '\n') { 153 if (line[nread - 1] == '\n') {
154 line[nread - 1] = '\0'; 154 line[nread - 1] = '\0';
155 } 155 }
156 wlr_log(WLR_INFO, "%s", line); 156 sway_log(SWAY_INFO, "%s", line);
157 } 157 }
158 free(line); 158 free(line);
159} 159}
@@ -169,7 +169,7 @@ static void log_distro(void) {
169 for (size_t i = 0; i < sizeof(paths) / sizeof(char *); ++i) { 169 for (size_t i = 0; i < sizeof(paths) / sizeof(char *); ++i) {
170 FILE *f = fopen(paths[i], "r"); 170 FILE *f = fopen(paths[i], "r");
171 if (f) { 171 if (f) {
172 wlr_log(WLR_INFO, "Contents of %s:", paths[i]); 172 sway_log(SWAY_INFO, "Contents of %s:", paths[i]);
173 log_file(f); 173 log_file(f);
174 fclose(f); 174 fclose(f);
175 } 175 }
@@ -179,7 +179,7 @@ static void log_distro(void) {
179static void log_kernel(void) { 179static void log_kernel(void) {
180 FILE *f = popen("uname -a", "r"); 180 FILE *f = popen("uname -a", "r");
181 if (!f) { 181 if (!f) {
182 wlr_log(WLR_INFO, "Unable to determine kernel version"); 182 sway_log(SWAY_INFO, "Unable to determine kernel version");
183 return; 183 return;
184 } 184 }
185 log_file(f); 185 log_file(f);
@@ -190,16 +190,16 @@ static void log_kernel(void) {
190static bool drop_permissions(void) { 190static bool drop_permissions(void) {
191 if (getuid() != geteuid() || getgid() != getegid()) { 191 if (getuid() != geteuid() || getgid() != getegid()) {
192 if (setgid(getgid()) != 0) { 192 if (setgid(getgid()) != 0) {
193 wlr_log(WLR_ERROR, "Unable to drop root, refusing to start"); 193 sway_log(SWAY_ERROR, "Unable to drop root, refusing to start");
194 return false; 194 return false;
195 } 195 }
196 if (setuid(getuid()) != 0) { 196 if (setuid(getuid()) != 0) {
197 wlr_log(WLR_ERROR, "Unable to drop root, refusing to start"); 197 sway_log(SWAY_ERROR, "Unable to drop root, refusing to start");
198 return false; 198 return false;
199 } 199 }
200 } 200 }
201 if (setuid(0) != -1) { 201 if (setuid(0) != -1) {
202 wlr_log(WLR_ERROR, "Unable to drop root (we shouldn't be able to " 202 sway_log(SWAY_ERROR, "Unable to drop root (we shouldn't be able to "
203 "restore it after setuid), refusing to start"); 203 "restore it after setuid), refusing to start");
204 return false; 204 return false;
205 } 205 }
@@ -303,17 +303,22 @@ int main(int argc, char **argv) {
303 } 303 }
304 } 304 }
305 305
306 // As the 'callback' function for wlr_log is equivalent to that for
307 // sway, we do not need to override it.
306 if (debug) { 308 if (debug) {
309 sway_log_init(SWAY_DEBUG, sway_terminate);
307 wlr_log_init(WLR_DEBUG, NULL); 310 wlr_log_init(WLR_DEBUG, NULL);
308 } else if (verbose || validate) { 311 } else if (verbose || validate) {
312 sway_log_init(SWAY_INFO, sway_terminate);
309 wlr_log_init(WLR_INFO, NULL); 313 wlr_log_init(WLR_INFO, NULL);
310 } else { 314 } else {
315 sway_log_init(SWAY_ERROR, sway_terminate);
311 wlr_log_init(WLR_ERROR, NULL); 316 wlr_log_init(WLR_ERROR, NULL);
312 } 317 }
313 318
314 if (optind < argc) { // Behave as IPC client 319 if (optind < argc) { // Behave as IPC client
315 if (optind != 1) { 320 if (optind != 1) {
316 wlr_log(WLR_ERROR, "Don't use options with the IPC client"); 321 sway_log(SWAY_ERROR, "Don't use options with the IPC client");
317 exit(EXIT_FAILURE); 322 exit(EXIT_FAILURE);
318 } 323 }
319 if (!drop_permissions()) { 324 if (!drop_permissions()) {
@@ -321,7 +326,7 @@ int main(int argc, char **argv) {
321 } 326 }
322 char *socket_path = getenv("SWAYSOCK"); 327 char *socket_path = getenv("SWAYSOCK");
323 if (!socket_path) { 328 if (!socket_path) {
324 wlr_log(WLR_ERROR, "Unable to retrieve socket path"); 329 sway_log(SWAY_ERROR, "Unable to retrieve socket path");
325 exit(EXIT_FAILURE); 330 exit(EXIT_FAILURE);
326 } 331 }
327 char *command = join_args(argv + optind, argc - optind); 332 char *command = join_args(argv + optind, argc - optind);
@@ -349,7 +354,7 @@ int main(int argc, char **argv) {
349 // prevent ipc from crashing sway 354 // prevent ipc from crashing sway
350 signal(SIGPIPE, SIG_IGN); 355 signal(SIGPIPE, SIG_IGN);
351 356
352 wlr_log(WLR_INFO, "Starting sway version " SWAY_VERSION); 357 sway_log(SWAY_INFO, "Starting sway version " SWAY_VERSION);
353 358
354 root = root_create(); 359 root = root_create();
355 360
@@ -383,14 +388,14 @@ int main(int argc, char **argv) {
383 config->active = true; 388 config->active = true;
384 load_swaybars(); 389 load_swaybars();
385 // Execute commands until there are none left 390 // Execute commands until there are none left
386 wlr_log(WLR_DEBUG, "Running deferred commands"); 391 sway_log(SWAY_DEBUG, "Running deferred commands");
387 while (config->cmd_queue->length) { 392 while (config->cmd_queue->length) {
388 char *line = config->cmd_queue->items[0]; 393 char *line = config->cmd_queue->items[0];
389 list_t *res_list = execute_command(line, NULL, NULL); 394 list_t *res_list = execute_command(line, NULL, NULL);
390 for (int i = 0; i < res_list->length; ++i) { 395 for (int i = 0; i < res_list->length; ++i) {
391 struct cmd_results *res = res_list->items[i]; 396 struct cmd_results *res = res_list->items[i];
392 if (res->status != CMD_SUCCESS) { 397 if (res->status != CMD_SUCCESS) {
393 wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error); 398 sway_log(SWAY_ERROR, "Error on line '%s': %s", line, res->error);
394 } 399 }
395 free_cmd_results(res); 400 free_cmd_results(res);
396 } 401 }
@@ -408,7 +413,7 @@ int main(int argc, char **argv) {
408 server_run(&server); 413 server_run(&server);
409 } 414 }
410 415
411 wlr_log(WLR_INFO, "Shutting down sway"); 416 sway_log(SWAY_INFO, "Shutting down sway");
412 417
413 server_fini(&server); 418 server_fini(&server);
414 root_destroy(root); 419 root_destroy(root);
diff --git a/sway/server.c b/sway/server.c
index 0529cab1..5ae9bb01 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -19,9 +19,9 @@
19#include <wlr/types/wlr_xcursor_manager.h> 19#include <wlr/types/wlr_xcursor_manager.h>
20#include <wlr/types/wlr_xdg_decoration_v1.h> 20#include <wlr/types/wlr_xdg_decoration_v1.h>
21#include <wlr/types/wlr_xdg_output_v1.h> 21#include <wlr/types/wlr_xdg_output_v1.h>
22#include <wlr/util/log.h>
23#include "config.h" 22#include "config.h"
24#include "list.h" 23#include "list.h"
24#include "log.h"
25#include "sway/config.h" 25#include "sway/config.h"
26#include "sway/desktop/idle_inhibit_v1.h" 26#include "sway/desktop/idle_inhibit_v1.h"
27#include "sway/input/input-manager.h" 27#include "sway/input/input-manager.h"
@@ -32,20 +32,20 @@
32#endif 32#endif
33 33
34bool server_privileged_prepare(struct sway_server *server) { 34bool server_privileged_prepare(struct sway_server *server) {
35 wlr_log(WLR_DEBUG, "Preparing Wayland server initialization"); 35 sway_log(SWAY_DEBUG, "Preparing Wayland server initialization");
36 server->wl_display = wl_display_create(); 36 server->wl_display = wl_display_create();
37 server->wl_event_loop = wl_display_get_event_loop(server->wl_display); 37 server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
38 server->backend = wlr_backend_autocreate(server->wl_display, NULL); 38 server->backend = wlr_backend_autocreate(server->wl_display, NULL);
39 39
40 if (!server->backend) { 40 if (!server->backend) {
41 wlr_log(WLR_ERROR, "Unable to create backend"); 41 sway_log(SWAY_ERROR, "Unable to create backend");
42 return false; 42 return false;
43 } 43 }
44 return true; 44 return true;
45} 45}
46 46
47bool server_init(struct sway_server *server) { 47bool server_init(struct sway_server *server) {
48 wlr_log(WLR_DEBUG, "Initializing Wayland server"); 48 sway_log(SWAY_DEBUG, "Initializing Wayland server");
49 49
50 struct wlr_renderer *renderer = wlr_backend_get_renderer(server->backend); 50 struct wlr_renderer *renderer = wlr_backend_get_renderer(server->backend);
51 assert(renderer); 51 assert(renderer);
@@ -111,7 +111,7 @@ bool server_init(struct sway_server *server) {
111 111
112 server->socket = wl_display_add_socket_auto(server->wl_display); 112 server->socket = wl_display_add_socket_auto(server->wl_display);
113 if (!server->socket) { 113 if (!server->socket) {
114 wlr_log(WLR_ERROR, "Unable to open wayland socket"); 114 sway_log(SWAY_ERROR, "Unable to open wayland socket");
115 wlr_backend_destroy(server->backend); 115 wlr_backend_destroy(server->backend);
116 return false; 116 return false;
117 } 117 }
@@ -155,7 +155,7 @@ bool server_start(struct sway_server *server) {
155 155
156#if HAVE_XWAYLAND 156#if HAVE_XWAYLAND
157 if (config->xwayland) { 157 if (config->xwayland) {
158 wlr_log(WLR_DEBUG, "Initializing Xwayland"); 158 sway_log(SWAY_DEBUG, "Initializing Xwayland");
159 server->xwayland.wlr_xwayland = 159 server->xwayland.wlr_xwayland =
160 wlr_xwayland_create(server->wl_display, server->compositor, true); 160 wlr_xwayland_create(server->wl_display, server->compositor, true);
161 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, 161 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
@@ -179,10 +179,10 @@ bool server_start(struct sway_server *server) {
179 } 179 }
180#endif 180#endif
181 181
182 wlr_log(WLR_INFO, "Starting backend on wayland display '%s'", 182 sway_log(SWAY_INFO, "Starting backend on wayland display '%s'",
183 server->socket); 183 server->socket);
184 if (!wlr_backend_start(server->backend)) { 184 if (!wlr_backend_start(server->backend)) {
185 wlr_log(WLR_ERROR, "Failed to start backend"); 185 sway_log(SWAY_ERROR, "Failed to start backend");
186 wlr_backend_destroy(server->backend); 186 wlr_backend_destroy(server->backend);
187 return false; 187 return false;
188 } 188 }
@@ -190,7 +190,7 @@ bool server_start(struct sway_server *server) {
190} 190}
191 191
192void server_run(struct sway_server *server) { 192void server_run(struct sway_server *server) {
193 wlr_log(WLR_INFO, "Running compositor on wayland display '%s'", 193 sway_log(SWAY_INFO, "Running compositor on wayland display '%s'",
194 server->socket); 194 server->socket);
195 wl_display_run(server->wl_display); 195 wl_display_run(server->wl_display);
196} 196}
diff --git a/sway/swaynag.c b/sway/swaynag.c
index 38e74b88..49027f5d 100644
--- a/sway/swaynag.c
+++ b/sway/swaynag.c
@@ -17,7 +17,7 @@ bool swaynag_spawn(const char *swaynag_command,
17 17
18 if (swaynag->detailed) { 18 if (swaynag->detailed) {
19 if (pipe(swaynag->fd) != 0) { 19 if (pipe(swaynag->fd) != 0) {
20 wlr_log(WLR_ERROR, "Failed to create pipe for swaynag"); 20 sway_log(SWAY_ERROR, "Failed to create pipe for swaynag");
21 return false; 21 return false;
22 } 22 }
23 fcntl(swaynag->fd[1], F_SETFD, FD_CLOEXEC); 23 fcntl(swaynag->fd[1], F_SETFD, FD_CLOEXEC);
@@ -37,7 +37,7 @@ bool swaynag_spawn(const char *swaynag_command,
37 execl("/bin/sh", "/bin/sh", "-c", cmd, NULL); 37 execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
38 _exit(0); 38 _exit(0);
39 } else if (pid < 0) { 39 } else if (pid < 0) {
40 wlr_log(WLR_ERROR, "Failed to create fork for swaynag"); 40 sway_log(SWAY_ERROR, "Failed to create fork for swaynag");
41 if (swaynag->detailed) { 41 if (swaynag->detailed) {
42 close(swaynag->fd[0]); 42 close(swaynag->fd[0]);
43 close(swaynag->fd[1]); 43 close(swaynag->fd[1]);
@@ -67,7 +67,7 @@ void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
67 } 67 }
68 68
69 if (!swaynag->detailed) { 69 if (!swaynag->detailed) {
70 wlr_log(WLR_ERROR, "Attempting to write to non-detailed swaynag inst"); 70 sway_log(SWAY_ERROR, "Attempting to write to non-detailed swaynag inst");
71 return; 71 return;
72 } 72 }
73 73
@@ -82,7 +82,7 @@ void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
82 82
83 char *temp = malloc(length + 1); 83 char *temp = malloc(length + 1);
84 if (!temp) { 84 if (!temp) {
85 wlr_log(WLR_ERROR, "Failed to allocate buffer for swaynag log entry."); 85 sway_log(SWAY_ERROR, "Failed to allocate buffer for swaynag log entry.");
86 return; 86 return;
87 } 87 }
88 88
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index 852d53bf..f78d95a4 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -35,7 +35,7 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) {
35 double scale = parent->width / total_width; 35 double scale = parent->width / total_width;
36 36
37 // Resize windows 37 // Resize windows
38 wlr_log(WLR_DEBUG, "Arranging %p horizontally", parent); 38 sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent);
39 double child_x = parent->x; 39 double child_x = parent->x;
40 for (int i = 0; i < children->length; ++i) { 40 for (int i = 0; i < children->length; ++i) {
41 struct sway_container *child = children->items[i]; 41 struct sway_container *child = children->items[i];
@@ -75,7 +75,7 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) {
75 double scale = parent->height / total_height; 75 double scale = parent->height / total_height;
76 76
77 // Resize 77 // Resize
78 wlr_log(WLR_DEBUG, "Arranging %p vertically", parent); 78 sway_log(SWAY_DEBUG, "Arranging %p vertically", parent);
79 double child_y = parent->y; 79 double child_y = parent->y;
80 for (int i = 0; i < children->length; ++i) { 80 for (int i = 0; i < children->length; ++i) {
81 struct sway_container *child = children->items[i]; 81 struct sway_container *child = children->items[i];
@@ -186,7 +186,7 @@ void arrange_workspace(struct sway_workspace *workspace) {
186 } 186 }
187 struct sway_output *output = workspace->output; 187 struct sway_output *output = workspace->output;
188 struct wlr_box *area = &output->usable_area; 188 struct wlr_box *area = &output->usable_area;
189 wlr_log(WLR_DEBUG, "Usable area for ws: %dx%d@%d,%d", 189 sway_log(SWAY_DEBUG, "Usable area for ws: %dx%d@%d,%d",
190 area->width, area->height, area->x, area->y); 190 area->width, area->height, area->x, area->y);
191 workspace_remove_gaps(workspace); 191 workspace_remove_gaps(workspace);
192 192
@@ -217,7 +217,7 @@ void arrange_workspace(struct sway_workspace *workspace) {
217 217
218 workspace_add_gaps(workspace); 218 workspace_add_gaps(workspace);
219 node_set_dirty(&workspace->node); 219 node_set_dirty(&workspace->node);
220 wlr_log(WLR_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name, 220 sway_log(SWAY_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name,
221 workspace->x, workspace->y); 221 workspace->x, workspace->y);
222 if (workspace->fullscreen) { 222 if (workspace->fullscreen) {
223 struct sway_container *fs = workspace->fullscreen; 223 struct sway_container *fs = workspace->fullscreen;
diff --git a/sway/tree/container.c b/sway/tree/container.c
index d9c721f5..97a52d91 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -28,7 +28,7 @@
28struct sway_container *container_create(struct sway_view *view) { 28struct sway_container *container_create(struct sway_view *view) {
29 struct sway_container *c = calloc(1, sizeof(struct sway_container)); 29 struct sway_container *c = calloc(1, sizeof(struct sway_container));
30 if (!c) { 30 if (!c) {
31 wlr_log(WLR_ERROR, "Unable to allocate sway_container"); 31 sway_log(SWAY_ERROR, "Unable to allocate sway_container");
32 return NULL; 32 return NULL;
33 } 33 }
34 node_init(&c->node, N_CONTAINER, c); 34 node_init(&c->node, N_CONTAINER, c);
@@ -983,7 +983,7 @@ void container_discover_outputs(struct sway_container *con) {
983 983
984 if (intersects && index == -1) { 984 if (intersects && index == -1) {
985 // Send enter 985 // Send enter
986 wlr_log(WLR_DEBUG, "Container %p entered output %p", con, output); 986 sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output);
987 if (con->view) { 987 if (con->view) {
988 view_for_each_surface(con->view, 988 view_for_each_surface(con->view,
989 surface_send_enter_iterator, output->wlr_output); 989 surface_send_enter_iterator, output->wlr_output);
@@ -991,7 +991,7 @@ void container_discover_outputs(struct sway_container *con) {
991 list_add(con->outputs, output); 991 list_add(con->outputs, output);
992 } else if (!intersects && index != -1) { 992 } else if (!intersects && index != -1) {
993 // Send leave 993 // Send leave
994 wlr_log(WLR_DEBUG, "Container %p left output %p", con, output); 994 sway_log(SWAY_DEBUG, "Container %p left output %p", con, output);
995 if (con->view) { 995 if (con->view) {
996 view_for_each_surface(con->view, 996 view_for_each_surface(con->view,
997 surface_send_leave_iterator, output->wlr_output); 997 surface_send_leave_iterator, output->wlr_output);
diff --git a/sway/tree/output.c b/sway/tree/output.c
index b79e70d4..7fbeeebd 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -97,7 +97,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
97 if (!output->workspaces->length) { 97 if (!output->workspaces->length) {
98 // Create workspace 98 // Create workspace
99 char *ws_name = workspace_next_name(wlr_output->name); 99 char *ws_name = workspace_next_name(wlr_output->name);
100 wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name); 100 sway_log(SWAY_DEBUG, "Creating default workspace %s", ws_name);
101 ws = workspace_create(output, ws_name); 101 ws = workspace_create(output, ws_name);
102 // Set each seat's focus if not already set 102 // Set each seat's focus if not already set
103 struct sway_seat *seat = NULL; 103 struct sway_seat *seat = NULL;
@@ -212,7 +212,7 @@ void output_disable(struct sway_output *output) {
212 if (!sway_assert(output->enabled, "Expected an enabled output")) { 212 if (!sway_assert(output->enabled, "Expected an enabled output")) {
213 return; 213 return;
214 } 214 }
215 wlr_log(WLR_DEBUG, "Disabling output '%s'", output->wlr_output->name); 215 sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
216 wl_signal_emit(&output->events.destroy, output); 216 wl_signal_emit(&output->events.destroy, output);
217 217
218 output_evacuate(output); 218 output_evacuate(output);
@@ -237,7 +237,7 @@ void output_begin_destroy(struct sway_output *output) {
237 if (!sway_assert(!output->enabled, "Expected a disabled output")) { 237 if (!sway_assert(!output->enabled, "Expected a disabled output")) {
238 return; 238 return;
239 } 239 }
240 wlr_log(WLR_DEBUG, "Destroying output '%s'", output->wlr_output->name); 240 sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name);
241 241
242 output->node.destroying = true; 242 output->node.destroying = true;
243 node_set_dirty(&output->node); 243 node_set_dirty(&output->node);
@@ -258,11 +258,11 @@ struct output_config *output_find_config(struct sway_output *output) {
258 258
259 if (strcasecmp(name, cur->name) == 0 || 259 if (strcasecmp(name, cur->name) == 0 ||
260 strcasecmp(identifier, cur->name) == 0) { 260 strcasecmp(identifier, cur->name) == 0) {
261 wlr_log(WLR_DEBUG, "Matched output config for %s", name); 261 sway_log(SWAY_DEBUG, "Matched output config for %s", name);
262 oc = cur; 262 oc = cur;
263 } 263 }
264 if (strcasecmp("*", cur->name) == 0) { 264 if (strcasecmp("*", cur->name) == 0) {
265 wlr_log(WLR_DEBUG, "Matched wildcard output config for %s", name); 265 sway_log(SWAY_DEBUG, "Matched wildcard output config for %s", name);
266 all = cur; 266 all = cur;
267 } 267 }
268 268
diff --git a/sway/tree/root.c b/sway/tree/root.c
index e5df8dd1..08ce7942 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -26,7 +26,7 @@ static void output_layout_handle_change(struct wl_listener *listener,
26struct sway_root *root_create(void) { 26struct sway_root *root_create(void) {
27 struct sway_root *root = calloc(1, sizeof(struct sway_root)); 27 struct sway_root *root = calloc(1, sizeof(struct sway_root));
28 if (!root) { 28 if (!root) {
29 wlr_log(WLR_ERROR, "Unable to allocate sway_root"); 29 sway_log(SWAY_ERROR, "Unable to allocate sway_root");
30 return NULL; 30 return NULL;
31 } 31 }
32 node_init(&root->node, N_ROOT, root); 32 node_init(&root->node, N_ROOT, root);
@@ -178,14 +178,14 @@ struct sway_workspace *root_workspace_for_pid(pid_t pid) {
178 struct sway_workspace *ws = NULL; 178 struct sway_workspace *ws = NULL;
179 struct pid_workspace *pw = NULL; 179 struct pid_workspace *pw = NULL;
180 180
181 wlr_log(WLR_DEBUG, "Looking up workspace for pid %d", pid); 181 sway_log(SWAY_DEBUG, "Looking up workspace for pid %d", pid);
182 182
183 do { 183 do {
184 struct pid_workspace *_pw = NULL; 184 struct pid_workspace *_pw = NULL;
185 wl_list_for_each(_pw, &pid_workspaces, link) { 185 wl_list_for_each(_pw, &pid_workspaces, link) {
186 if (pid == _pw->pid) { 186 if (pid == _pw->pid) {
187 pw = _pw; 187 pw = _pw;
188 wlr_log(WLR_DEBUG, 188 sway_log(SWAY_DEBUG,
189 "found pid_workspace for pid %d, workspace %s", 189 "found pid_workspace for pid %d, workspace %s",
190 pid, pw->workspace); 190 pid, pw->workspace);
191 goto found; 191 goto found;
@@ -199,7 +199,7 @@ found:
199 ws = workspace_by_name(pw->workspace); 199 ws = workspace_by_name(pw->workspace);
200 200
201 if (!ws) { 201 if (!ws) {
202 wlr_log(WLR_DEBUG, 202 sway_log(SWAY_DEBUG,
203 "Creating workspace %s for pid %d because it disappeared", 203 "Creating workspace %s for pid %d because it disappeared",
204 pw->workspace, pid); 204 pw->workspace, pid);
205 ws = workspace_create(pw->output, pw->workspace); 205 ws = workspace_create(pw->output, pw->workspace);
@@ -222,7 +222,7 @@ static void pw_handle_output_destroy(struct wl_listener *listener, void *data) {
222} 222}
223 223
224void root_record_workspace_pid(pid_t pid) { 224void root_record_workspace_pid(pid_t pid) {
225 wlr_log(WLR_DEBUG, "Recording workspace for process %d", pid); 225 sway_log(SWAY_DEBUG, "Recording workspace for process %d", pid);
226 if (!pid_workspaces.prev && !pid_workspaces.next) { 226 if (!pid_workspaces.prev && !pid_workspaces.next) {
227 wl_list_init(&pid_workspaces); 227 wl_list_init(&pid_workspaces);
228 } 228 }
@@ -230,12 +230,12 @@ void root_record_workspace_pid(pid_t pid) {
230 struct sway_seat *seat = input_manager_current_seat(); 230 struct sway_seat *seat = input_manager_current_seat();
231 struct sway_workspace *ws = seat_get_focused_workspace(seat); 231 struct sway_workspace *ws = seat_get_focused_workspace(seat);
232 if (!ws) { 232 if (!ws) {
233 wlr_log(WLR_DEBUG, "Bailing out, no workspace"); 233 sway_log(SWAY_DEBUG, "Bailing out, no workspace");
234 return; 234 return;
235 } 235 }
236 struct sway_output *output = ws->output; 236 struct sway_output *output = ws->output;
237 if (!output) { 237 if (!output) {
238 wlr_log(WLR_DEBUG, "Bailing out, no output"); 238 sway_log(SWAY_DEBUG, "Bailing out, no output");
239 return; 239 return;
240 } 240 }
241 241
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e65968c6..bc252521 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -328,7 +328,7 @@ void view_request_activate(struct sway_view *view) {
328} 328}
329 329
330void view_set_csd_from_server(struct sway_view *view, bool enabled) { 330void view_set_csd_from_server(struct sway_view *view, bool enabled) {
331 wlr_log(WLR_DEBUG, "Telling view %p to set CSD to %i", view, enabled); 331 sway_log(SWAY_DEBUG, "Telling view %p to set CSD to %i", view, enabled);
332 if (view->xdg_decoration) { 332 if (view->xdg_decoration) {
333 uint32_t mode = enabled ? 333 uint32_t mode = enabled ?
334 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE : 334 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE :
@@ -340,7 +340,7 @@ void view_set_csd_from_server(struct sway_view *view, bool enabled) {
340} 340}
341 341
342void view_update_csd_from_client(struct sway_view *view, bool enabled) { 342void view_update_csd_from_client(struct sway_view *view, bool enabled) {
343 wlr_log(WLR_DEBUG, "View %p updated CSD to %i", view, enabled); 343 sway_log(SWAY_DEBUG, "View %p updated CSD to %i", view, enabled);
344 struct sway_container *con = view->container; 344 struct sway_container *con = view->container;
345 if (enabled && con && con->border != B_CSD) { 345 if (enabled && con && con->border != B_CSD) {
346 con->saved_border = con->border; 346 con->saved_border = con->border;
@@ -429,12 +429,12 @@ void view_execute_criteria(struct sway_view *view) {
429 list_t *criterias = criteria_for_view(view, CT_COMMAND); 429 list_t *criterias = criteria_for_view(view, CT_COMMAND);
430 for (int i = 0; i < criterias->length; i++) { 430 for (int i = 0; i < criterias->length; i++) {
431 struct criteria *criteria = criterias->items[i]; 431 struct criteria *criteria = criterias->items[i];
432 wlr_log(WLR_DEBUG, "Checking criteria %s", criteria->raw); 432 sway_log(SWAY_DEBUG, "Checking criteria %s", criteria->raw);
433 if (view_has_executed_criteria(view, criteria)) { 433 if (view_has_executed_criteria(view, criteria)) {
434 wlr_log(WLR_DEBUG, "Criteria already executed"); 434 sway_log(SWAY_DEBUG, "Criteria already executed");
435 continue; 435 continue;
436 } 436 }
437 wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'", 437 sway_log(SWAY_DEBUG, "for_window '%s' matches view %p, cmd: '%s'",
438 criteria->raw, view, criteria->cmdlist); 438 criteria->raw, view, criteria->cmdlist);
439 list_add(view->executed_criteria, criteria); 439 list_add(view->executed_criteria, criteria);
440 list_t *res_list = execute_command( 440 list_t *res_list = execute_command(
@@ -721,7 +721,7 @@ static void view_subsurface_create(struct sway_view *view,
721 struct sway_subsurface *subsurface = 721 struct sway_subsurface *subsurface =
722 calloc(1, sizeof(struct sway_subsurface)); 722 calloc(1, sizeof(struct sway_subsurface));
723 if (subsurface == NULL) { 723 if (subsurface == NULL) {
724 wlr_log(WLR_ERROR, "Allocation failed"); 724 sway_log(SWAY_ERROR, "Allocation failed");
725 return; 725 return;
726 } 726 }
727 view_child_init(&subsurface->child, &subsurface_impl, view, 727 view_child_init(&subsurface->child, &subsurface_impl, view,
@@ -860,7 +860,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
860 } 860 }
861 861
862 const char *role = wlr_surface->role ? wlr_surface->role->name : NULL; 862 const char *role = wlr_surface->role ? wlr_surface->role->name : NULL;
863 wlr_log(WLR_DEBUG, "Surface of unknown type (role %s): %p", 863 sway_log(SWAY_DEBUG, "Surface of unknown type (role %s): %p",
864 role, wlr_surface); 864 role, wlr_surface);
865 return NULL; 865 return NULL;
866} 866}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 7f18046d..e89c0849 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -69,12 +69,12 @@ struct sway_workspace *workspace_create(struct sway_output *output,
69 output = workspace_get_initial_output(name); 69 output = workspace_get_initial_output(name);
70 } 70 }
71 71
72 wlr_log(WLR_DEBUG, "Adding workspace %s for output %s", name, 72 sway_log(SWAY_DEBUG, "Adding workspace %s for output %s", name,
73 output->wlr_output->name); 73 output->wlr_output->name);
74 74
75 struct sway_workspace *ws = calloc(1, sizeof(struct sway_workspace)); 75 struct sway_workspace *ws = calloc(1, sizeof(struct sway_workspace));
76 if (!ws) { 76 if (!ws) {
77 wlr_log(WLR_ERROR, "Unable to allocate sway_workspace"); 77 sway_log(SWAY_ERROR, "Unable to allocate sway_workspace");
78 return NULL; 78 return NULL;
79 } 79 }
80 node_init(&ws->node, N_WORKSPACE, ws); 80 node_init(&ws->node, N_WORKSPACE, ws);
@@ -152,7 +152,7 @@ void workspace_destroy(struct sway_workspace *workspace) {
152} 152}
153 153
154void workspace_begin_destroy(struct sway_workspace *workspace) { 154void workspace_begin_destroy(struct sway_workspace *workspace) {
155 wlr_log(WLR_DEBUG, "Destroying workspace '%s'", workspace->name); 155 sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name);
156 ipc_event_workspace(NULL, workspace, "empty"); // intentional 156 ipc_event_workspace(NULL, workspace, "empty"); // intentional
157 wl_signal_emit(&workspace->node.events.destroy, &workspace->node); 157 wl_signal_emit(&workspace->node.events.destroy, &workspace->node);
158 158
@@ -223,7 +223,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
223 char *_target = strdup(name); 223 char *_target = strdup(name);
224 _target = do_var_replacement(_target); 224 _target = do_var_replacement(_target);
225 strip_quotes(_target); 225 strip_quotes(_target);
226 wlr_log(WLR_DEBUG, "Got valid workspace command for target: '%s'", 226 sway_log(SWAY_DEBUG, "Got valid workspace command for target: '%s'",
227 _target); 227 _target);
228 228
229 // Make sure that the command references an actual workspace 229 // Make sure that the command references an actual workspace
@@ -248,7 +248,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
248 temp[length - 1] = '\0'; 248 temp[length - 1] = '\0';
249 free(_target); 249 free(_target);
250 _target = temp; 250 _target = temp;
251 wlr_log(WLR_DEBUG, "Isolated name from workspace number: '%s'", _target); 251 sway_log(SWAY_DEBUG, "Isolated name from workspace number: '%s'", _target);
252 252
253 // Make sure the workspace number doesn't already exist 253 // Make sure the workspace number doesn't already exist
254 if (isdigit(_target[0]) && workspace_by_number(_target)) { 254 if (isdigit(_target[0]) && workspace_by_number(_target)) {
@@ -277,7 +277,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
277 *min_order = binding->order; 277 *min_order = binding->order;
278 free(*earliest_name); 278 free(*earliest_name);
279 *earliest_name = _target; 279 *earliest_name = _target;
280 wlr_log(WLR_DEBUG, "Workspace: Found free name %s", _target); 280 sway_log(SWAY_DEBUG, "Workspace: Found free name %s", _target);
281 } else { 281 } else {
282 free(_target); 282 free(_target);
283 } 283 }
@@ -286,7 +286,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
286} 286}
287 287
288char *workspace_next_name(const char *output_name) { 288char *workspace_next_name(const char *output_name) {
289 wlr_log(WLR_DEBUG, "Workspace: Generating new workspace name for output %s", 289 sway_log(SWAY_DEBUG, "Workspace: Generating new workspace name for output %s",
290 output_name); 290 output_name);
291 // Scan for available workspace names by looking through output-workspace 291 // Scan for available workspace names by looking through output-workspace
292 // assignments primarily, falling back to bindings and numbers. 292 // assignments primarily, falling back to bindings and numbers.
@@ -468,13 +468,13 @@ bool workspace_switch(struct sway_workspace *workspace,
468 free(seat->prev_workspace_name); 468 free(seat->prev_workspace_name);
469 seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); 469 seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1);
470 if (!seat->prev_workspace_name) { 470 if (!seat->prev_workspace_name) {
471 wlr_log(WLR_ERROR, "Unable to allocate previous workspace name"); 471 sway_log(SWAY_ERROR, "Unable to allocate previous workspace name");
472 return false; 472 return false;
473 } 473 }
474 strcpy(seat->prev_workspace_name, active_ws->name); 474 strcpy(seat->prev_workspace_name, active_ws->name);
475 } 475 }
476 476
477 wlr_log(WLR_DEBUG, "Switching to workspace %p:%s", 477 sway_log(SWAY_DEBUG, "Switching to workspace %p:%s",
478 workspace, workspace->name); 478 workspace, workspace->name);
479 struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); 479 struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node);
480 if (next == NULL) { 480 if (next == NULL) {
diff --git a/swaybar/bar.c b/swaybar/bar.c
index d36367fc..a1f7bfdb 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -10,7 +10,6 @@
10#include <unistd.h> 10#include <unistd.h>
11#include <wayland-client.h> 11#include <wayland-client.h>
12#include <wayland-cursor.h> 12#include <wayland-cursor.h>
13#include <wlr/util/log.h>
14#include "config.h" 13#include "config.h"
15#include "swaybar/bar.h" 14#include "swaybar/bar.h"
16#include "swaybar/config.h" 15#include "swaybar/config.h"
@@ -44,7 +43,7 @@ static void swaybar_output_free(struct swaybar_output *output) {
44 if (!output) { 43 if (!output) {
45 return; 44 return;
46 } 45 }
47 wlr_log(WLR_DEBUG, "Removing output %s", output->name); 46 sway_log(SWAY_DEBUG, "Removing output %s", output->name);
48 if (output->layer_surface != NULL) { 47 if (output->layer_surface != NULL) {
49 zwlr_layer_surface_v1_destroy(output->layer_surface); 48 zwlr_layer_surface_v1_destroy(output->layer_surface);
50 } 49 }
@@ -157,7 +156,7 @@ bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) {
157 bar->visible = visible; 156 bar->visible = visible;
158 157
159 if (bar->status) { 158 if (bar->status) {
160 wlr_log(WLR_DEBUG, "Sending %s signal to status command", 159 sway_log(SWAY_DEBUG, "Sending %s signal to status command",
161 visible ? "cont" : "stop"); 160 visible ? "cont" : "stop");
162 kill(bar->status->pid, visible ? 161 kill(bar->status->pid, visible ?
163 bar->status->cont_signal : bar->status->stop_signal); 162 bar->status->cont_signal : bar->status->stop_signal);
@@ -271,7 +270,7 @@ static void xdg_output_handle_description(void *data,
271 size_t length = paren - description; 270 size_t length = paren - description;
272 output->identifier = malloc(length); 271 output->identifier = malloc(length);
273 if (!output->identifier) { 272 if (!output->identifier) {
274 wlr_log(WLR_ERROR, "Failed to allocate output identifier"); 273 sway_log(SWAY_ERROR, "Failed to allocate output identifier");
275 return; 274 return;
276 } 275 }
277 strncpy(output->identifier, description, length); 276 strncpy(output->identifier, description, length);
diff --git a/swaybar/config.c b/swaybar/config.c
index 0071c7f9..b94fcfee 100644
--- a/swaybar/config.c
+++ b/swaybar/config.c
@@ -1,12 +1,12 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <stdlib.h> 2#include <stdlib.h>
3#include <string.h> 3#include <string.h>
4#include <wlr/util/log.h>
5#include "swaybar/config.h" 4#include "swaybar/config.h"
6#include "wlr-layer-shell-unstable-v1-client-protocol.h" 5#include "wlr-layer-shell-unstable-v1-client-protocol.h"
7#include "config.h" 6#include "config.h"
8#include "stringop.h" 7#include "stringop.h"
9#include "list.h" 8#include "list.h"
9#include "log.h"
10 10
11uint32_t parse_position(const char *position) { 11uint32_t parse_position(const char *position) {
12 uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | 12 uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
@@ -16,7 +16,7 @@ uint32_t parse_position(const char *position) {
16 } else if (strcmp("bottom", position) == 0) { 16 } else if (strcmp("bottom", position) == 0) {
17 return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; 17 return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
18 } else { 18 } else {
19 wlr_log(WLR_ERROR, "Invalid position: %s, defaulting to bottom", position); 19 sway_log(SWAY_ERROR, "Invalid position: %s, defaulting to bottom", position);
20 return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; 20 return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
21 } 21 }
22} 22}
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c
index 8bca1bf9..e938694c 100644
--- a/swaybar/i3bar.c
+++ b/swaybar/i3bar.c
@@ -5,7 +5,7 @@
5#include <stdlib.h> 5#include <stdlib.h>
6#include <string.h> 6#include <string.h>
7#include <unistd.h> 7#include <unistd.h>
8#include <wlr/util/log.h> 8#include "log.h"
9#include "swaybar/bar.h" 9#include "swaybar/bar.h"
10#include "swaybar/config.h" 10#include "swaybar/config.h"
11#include "swaybar/i3bar.h" 11#include "swaybar/i3bar.h"
@@ -120,7 +120,7 @@ bool i3bar_handle_readable(struct status_line *status) {
120 memmove(status->buffer, &status->buffer[c], status->buffer_index); 120 memmove(status->buffer, &status->buffer[c], status->buffer_index);
121 break; 121 break;
122 } else if (!isspace(status->buffer[c])) { 122 } else if (!isspace(status->buffer[c])) {
123 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'", 123 sway_log(SWAY_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'",
124 status->buffer[c]); 124 status->buffer[c]);
125 status_error(status, "[invalid i3bar json]"); 125 status_error(status, "[invalid i3bar json]");
126 return true; 126 return true;
@@ -160,7 +160,7 @@ bool i3bar_handle_readable(struct status_line *status) {
160 ++buffer_pos; 160 ++buffer_pos;
161 break; 161 break;
162 } else if (!isspace(status->buffer[buffer_pos])) { 162 } else if (!isspace(status->buffer[buffer_pos])) {
163 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'", 163 sway_log(SWAY_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'",
164 status->buffer[buffer_pos]); 164 status->buffer[buffer_pos]);
165 status_error(status, "[invalid i3bar json]"); 165 status_error(status, "[invalid i3bar json]");
166 return true; 166 return true;
@@ -195,7 +195,7 @@ bool i3bar_handle_readable(struct status_line *status) {
195 } 195 }
196 *last_char_pos = '\0'; 196 *last_char_pos = '\0';
197 size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v"); 197 size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v");
198 wlr_log(WLR_DEBUG, "Received i3bar json: '%s%c'", 198 sway_log(SWAY_DEBUG, "Received i3bar json: '%s%c'",
199 &status->buffer[buffer_pos + offset], last_char); 199 &status->buffer[buffer_pos + offset], last_char);
200 *last_char_pos = last_char; 200 *last_char_pos = last_char;
201 201
@@ -229,7 +229,7 @@ bool i3bar_handle_readable(struct status_line *status) {
229 } else { 229 } else {
230 char last_char = status->buffer[status->buffer_index - 1]; 230 char last_char = status->buffer[status->buffer_index - 1];
231 status->buffer[status->buffer_index - 1] = '\0'; 231 status->buffer[status->buffer_index - 1] = '\0';
232 wlr_log(WLR_DEBUG, "Failed to parse i3bar json - %s: '%s%c'", 232 sway_log(SWAY_DEBUG, "Failed to parse i3bar json - %s: '%s%c'",
233 json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char); 233 json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char);
234 status_error(status, "[failed to parse i3bar json]"); 234 status_error(status, "[failed to parse i3bar json]");
235 return true; 235 return true;
@@ -250,7 +250,7 @@ bool i3bar_handle_readable(struct status_line *status) {
250 } 250 }
251 251
252 if (last_object) { 252 if (last_object) {
253 wlr_log(WLR_DEBUG, "Rendering last received json"); 253 sway_log(SWAY_DEBUG, "Rendering last received json");
254 i3bar_parse_json(status, last_object); 254 i3bar_parse_json(status, last_object);
255 json_object_put(last_object); 255 json_object_put(last_object);
256 return true; 256 return true;
@@ -262,7 +262,7 @@ bool i3bar_handle_readable(struct status_line *status) {
262enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, 262enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
263 struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h, 263 struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h,
264 uint32_t button) { 264 uint32_t button) {
265 wlr_log(WLR_DEBUG, "block %s clicked", block->name); 265 sway_log(SWAY_DEBUG, "block %s clicked", block->name);
266 if (!block->name || !status->click_events) { 266 if (!block->name || !status->click_events) {
267 return HOTSPOT_PROCESS; 267 return HOTSPOT_PROCESS;
268 } 268 }
diff --git a/swaybar/input.c b/swaybar/input.c
index 998b186f..e416f6e7 100644
--- a/swaybar/input.c
+++ b/swaybar/input.c
@@ -3,7 +3,6 @@
3#include <stdlib.h> 3#include <stdlib.h>
4#include <wayland-client.h> 4#include <wayland-client.h>
5#include <wayland-cursor.h> 5#include <wayland-cursor.h>
6#include <wlr/util/log.h>
7#include "list.h" 6#include "list.h"
8#include "log.h" 7#include "log.h"
9#include "swaybar/bar.h" 8#include "swaybar/bar.h"
@@ -55,7 +54,7 @@ static uint32_t wl_axis_to_button(uint32_t axis, wl_fixed_t value) {
55 case WL_POINTER_AXIS_HORIZONTAL_SCROLL: 54 case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
56 return negative ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; 55 return negative ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT;
57 default: 56 default:
58 wlr_log(WLR_DEBUG, "Unexpected axis value on mouse scroll"); 57 sway_log(SWAY_DEBUG, "Unexpected axis value on mouse scroll");
59 return 0; 58 return 0;
60 } 59 }
61} 60}
diff --git a/swaybar/ipc.c b/swaybar/ipc.c
index 5565dc76..29b782bb 100644
--- a/swaybar/ipc.c
+++ b/swaybar/ipc.c
@@ -3,12 +3,12 @@
3#include <string.h> 3#include <string.h>
4#include <strings.h> 4#include <strings.h>
5#include <json-c/json.h> 5#include <json-c/json.h>
6#include <wlr/util/log.h>
7#include "swaybar/config.h" 6#include "swaybar/config.h"
8#include "swaybar/ipc.h" 7#include "swaybar/ipc.h"
9#include "config.h" 8#include "config.h"
10#include "ipc-client.h" 9#include "ipc-client.h"
11#include "list.h" 10#include "list.h"
11#include "log.h"
12 12
13void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { 13void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
14 const char *fmt = "workspace \"%s\""; 14 const char *fmt = "workspace \"%s\"";
@@ -150,7 +150,7 @@ static bool ipc_parse_config(
150 json_object *success; 150 json_object *success;
151 if (json_object_object_get_ex(bar_config, "success", &success) 151 if (json_object_object_get_ex(bar_config, "success", &success)
152 && !json_object_get_boolean(success)) { 152 && !json_object_get_boolean(success)) {
153 wlr_log(WLR_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs."); 153 sway_log(SWAY_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs.");
154 json_object_put(bar_config); 154 json_object_put(bar_config);
155 return false; 155 return false;
156 } 156 }
@@ -441,7 +441,7 @@ static void ipc_get_outputs(struct swaybar *bar) {
441} 441}
442 442
443void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) { 443void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) {
444 wlr_log(WLR_DEBUG, "Executing binding for button %u (release=%d): `%s`", 444 sway_log(SWAY_DEBUG, "Executing binding for button %u (release=%d): `%s`",
445 bind->button, bind->release, bind->command); 445 bind->button, bind->release, bind->command);
446 uint32_t len = strlen(bind->command); 446 uint32_t len = strlen(bind->command);
447 free(ipc_single_command(bar->ipc_socketfd, 447 free(ipc_single_command(bar->ipc_socketfd,
@@ -500,7 +500,7 @@ static bool handle_barconfig_update(struct swaybar *bar,
500 const char *new_state = json_object_get_string(json_state); 500 const char *new_state = json_object_get_string(json_state);
501 char *old_state = config->hidden_state; 501 char *old_state = config->hidden_state;
502 if (strcmp(new_state, old_state) != 0) { 502 if (strcmp(new_state, old_state) != 0) {
503 wlr_log(WLR_DEBUG, "Changing bar hidden state to %s", new_state); 503 sway_log(SWAY_DEBUG, "Changing bar hidden state to %s", new_state);
504 free(old_state); 504 free(old_state);
505 config->hidden_state = strdup(new_state); 505 config->hidden_state = strdup(new_state);
506 return determine_bar_visibility(bar, false); 506 return determine_bar_visibility(bar, false);
@@ -510,7 +510,7 @@ static bool handle_barconfig_update(struct swaybar *bar,
510 json_object *json_mode; 510 json_object *json_mode;
511 json_object_object_get_ex(json_config, "mode", &json_mode); 511 json_object_object_get_ex(json_config, "mode", &json_mode);
512 config->mode = strdup(json_object_get_string(json_mode)); 512 config->mode = strdup(json_object_get_string(json_mode));
513 wlr_log(WLR_DEBUG, "Changing bar mode to %s", config->mode); 513 sway_log(SWAY_DEBUG, "Changing bar mode to %s", config->mode);
514 514
515 json_object *gaps; 515 json_object *gaps;
516 json_object_object_get_ex(json_config, "gaps", &gaps); 516 json_object_object_get_ex(json_config, "gaps", &gaps);
@@ -544,7 +544,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
544 544
545 json_object *result = json_tokener_parse(resp->payload); 545 json_object *result = json_tokener_parse(resp->payload);
546 if (!result) { 546 if (!result) {
547 wlr_log(WLR_ERROR, "failed to parse payload as json"); 547 sway_log(SWAY_ERROR, "failed to parse payload as json");
548 free_ipc_response(resp); 548 free_ipc_response(resp);
549 return false; 549 return false;
550 } 550 }
@@ -561,7 +561,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
561 free(bar->mode); 561 free(bar->mode);
562 bar->mode = strcmp(change, "default") != 0 ? strdup(change) : NULL; 562 bar->mode = strcmp(change, "default") != 0 ? strdup(change) : NULL;
563 } else { 563 } else {
564 wlr_log(WLR_ERROR, "failed to parse response"); 564 sway_log(SWAY_ERROR, "failed to parse response");
565 bar_is_dirty = false; 565 bar_is_dirty = false;
566 break; 566 break;
567 } 567 }
diff --git a/swaybar/main.c b/swaybar/main.c
index fa99b1ba..4ef74629 100644
--- a/swaybar/main.c
+++ b/swaybar/main.c
@@ -4,9 +4,9 @@
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>
8#include "swaybar/bar.h" 7#include "swaybar/bar.h"
9#include "ipc-client.h" 8#include "ipc-client.h"
9#include "log.h"
10 10
11static struct swaybar swaybar; 11static struct swaybar swaybar;
12 12
@@ -74,13 +74,13 @@ int main(int argc, char **argv) {
74 } 74 }
75 75
76 if (debug) { 76 if (debug) {
77 wlr_log_init(WLR_DEBUG, NULL); 77 sway_log_init(SWAY_DEBUG, NULL);
78 } else { 78 } else {
79 wlr_log_init(WLR_INFO, NULL); 79 sway_log_init(SWAY_INFO, NULL);
80 } 80 }
81 81
82 if (!swaybar.id) { 82 if (!swaybar.id) {
83 wlr_log(WLR_ERROR, "No bar_id passed. " 83 sway_log(SWAY_ERROR, "No bar_id passed. "
84 "Provide --bar_id or let sway start swaybar"); 84 "Provide --bar_id or let sway start swaybar");
85 return 1; 85 return 1;
86 } 86 }
@@ -88,7 +88,7 @@ int main(int argc, char **argv) {
88 if (!socket_path) { 88 if (!socket_path) {
89 socket_path = get_socketpath(); 89 socket_path = get_socketpath();
90 if (!socket_path) { 90 if (!socket_path) {
91 wlr_log(WLR_ERROR, "Unable to retrieve socket path"); 91 sway_log(SWAY_ERROR, "Unable to retrieve socket path");
92 return 1; 92 return 1;
93 } 93 }
94 } 94 }
diff --git a/swaybar/render.c b/swaybar/render.c
index 55f680ed..e27f7d4c 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -5,7 +5,6 @@
5#include <stdlib.h> 5#include <stdlib.h>
6#include <stdint.h> 6#include <stdint.h>
7#include <string.h> 7#include <string.h>
8#include <wlr/util/log.h>
9#include "cairo.h" 8#include "cairo.h"
10#include "pango.h" 9#include "pango.h"
11#include "pool-buffer.h" 10#include "pool-buffer.h"
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index f0e2c300..39ae8670 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -6,7 +6,7 @@
6#include <string.h> 6#include <string.h>
7#include <stdio.h> 7#include <stdio.h>
8#include <unistd.h> 8#include <unistd.h>
9#include <wlr/util/log.h> 9#include "log.h"
10#include "loop.h" 10#include "loop.h"
11#include "swaybar/bar.h" 11#include "swaybar/bar.h"
12#include "swaybar/config.h" 12#include "swaybar/config.h"
@@ -38,7 +38,7 @@ bool status_handle_readable(struct status_line *status) {
38 errno = 0; 38 errno = 0;
39 int available_bytes; 39 int available_bytes;
40 if (ioctl(status->read_fd, FIONREAD, &available_bytes) == -1) { 40 if (ioctl(status->read_fd, FIONREAD, &available_bytes) == -1) {
41 wlr_log(WLR_ERROR, "Unable to read status command output size"); 41 sway_log(SWAY_ERROR, "Unable to read status command output size");
42 status_error(status, "[error reading from status command]"); 42 status_error(status, "[error reading from status command]");
43 return true; 43 return true;
44 } 44 }
@@ -49,7 +49,7 @@ bool status_handle_readable(struct status_line *status) {
49 status->buffer = realloc(status->buffer, status->buffer_size); 49 status->buffer = realloc(status->buffer, status->buffer_size);
50 } 50 }
51 if (status->buffer == NULL) { 51 if (status->buffer == NULL) {
52 wlr_log_errno(WLR_ERROR, "Unable to read status line"); 52 sway_log_errno(SWAY_ERROR, "Unable to read status line");
53 status_error(status, "[error reading from status command]"); 53 status_error(status, "[error reading from status command]");
54 return true; 54 return true;
55 } 55 }
@@ -68,13 +68,13 @@ bool status_handle_readable(struct status_line *status) {
68 && (header = json_tokener_parse(status->buffer)) 68 && (header = json_tokener_parse(status->buffer))
69 && json_object_object_get_ex(header, "version", &version) 69 && json_object_object_get_ex(header, "version", &version)
70 && json_object_get_int(version) == 1) { 70 && json_object_get_int(version) == 1) {
71 wlr_log(WLR_DEBUG, "Using i3bar protocol."); 71 sway_log(SWAY_DEBUG, "Using i3bar protocol.");
72 status->protocol = PROTOCOL_I3BAR; 72 status->protocol = PROTOCOL_I3BAR;
73 73
74 json_object *click_events; 74 json_object *click_events;
75 if (json_object_object_get_ex(header, "click_events", &click_events) 75 if (json_object_object_get_ex(header, "click_events", &click_events)
76 && json_object_get_boolean(click_events)) { 76 && json_object_get_boolean(click_events)) {
77 wlr_log(WLR_DEBUG, "Enabling click events."); 77 sway_log(SWAY_DEBUG, "Enabling click events.");
78 status->click_events = true; 78 status->click_events = true;
79 if (write(status->write_fd, "[\n", 2) != 2) { 79 if (write(status->write_fd, "[\n", 2) != 2) {
80 status_error(status, "[failed to write to status command]"); 80 status_error(status, "[failed to write to status command]");
@@ -86,11 +86,11 @@ bool status_handle_readable(struct status_line *status) {
86 json_object *signal; 86 json_object *signal;
87 if (json_object_object_get_ex(header, "stop_signal", &signal)) { 87 if (json_object_object_get_ex(header, "stop_signal", &signal)) {
88 status->stop_signal = json_object_get_int(signal); 88 status->stop_signal = json_object_get_int(signal);
89 wlr_log(WLR_DEBUG, "Setting stop signal to %d", status->stop_signal); 89 sway_log(SWAY_DEBUG, "Setting stop signal to %d", status->stop_signal);
90 } 90 }
91 if (json_object_object_get_ex(header, "cont_signal", &signal)) { 91 if (json_object_object_get_ex(header, "cont_signal", &signal)) {
92 status->cont_signal = json_object_get_int(signal); 92 status->cont_signal = json_object_get_int(signal);
93 wlr_log(WLR_DEBUG, "Setting cont signal to %d", status->cont_signal); 93 sway_log(SWAY_DEBUG, "Setting cont signal to %d", status->cont_signal);
94 } 94 }
95 95
96 json_object_put(header); 96 json_object_put(header);
@@ -102,7 +102,7 @@ bool status_handle_readable(struct status_line *status) {
102 return i3bar_handle_readable(status); 102 return i3bar_handle_readable(status);
103 } 103 }
104 104
105 wlr_log(WLR_DEBUG, "Using text protocol."); 105 sway_log(SWAY_DEBUG, "Using text protocol.");
106 status->protocol = PROTOCOL_TEXT; 106 status->protocol = PROTOCOL_TEXT;
107 status->text = status->buffer; 107 status->text = status->buffer;
108 // intentional fall-through 108 // intentional fall-through
@@ -140,7 +140,7 @@ struct status_line *status_line_init(char *cmd) {
140 int pipe_read_fd[2]; 140 int pipe_read_fd[2];
141 int pipe_write_fd[2]; 141 int pipe_write_fd[2];
142 if (pipe(pipe_read_fd) != 0 || pipe(pipe_write_fd) != 0) { 142 if (pipe(pipe_read_fd) != 0 || pipe(pipe_write_fd) != 0) {
143 wlr_log(WLR_ERROR, "Unable to create pipes for status_command fork"); 143 sway_log(SWAY_ERROR, "Unable to create pipes for status_command fork");
144 exit(1); 144 exit(1);
145 } 145 }
146 146
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c
index cc8dd188..215e1e72 100644
--- a/swaybar/tray/host.c
+++ b/swaybar/tray/host.c
@@ -21,7 +21,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
21static void add_sni(struct swaybar_tray *tray, char *id) { 21static void add_sni(struct swaybar_tray *tray, char *id) {
22 int idx = list_seq_find(tray->items, cmp_sni_id, id); 22 int idx = list_seq_find(tray->items, cmp_sni_id, id);
23 if (idx == -1) { 23 if (idx == -1) {
24 wlr_log(WLR_INFO, "Registering Status Notifier Item '%s'", id); 24 sway_log(SWAY_INFO, "Registering Status Notifier Item '%s'", id);
25 struct swaybar_sni *sni = create_sni(id, tray); 25 struct swaybar_sni *sni = create_sni(id, tray);
26 if (sni) { 26 if (sni) {
27 list_add(tray->items, sni); 27 list_add(tray->items, sni);
@@ -34,7 +34,7 @@ static int handle_sni_registered(sd_bus_message *msg, void *data,
34 char *id; 34 char *id;
35 int ret = sd_bus_message_read(msg, "s", &id); 35 int ret = sd_bus_message_read(msg, "s", &id);
36 if (ret < 0) { 36 if (ret < 0) {
37 wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); 37 sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
38 } 38 }
39 39
40 struct swaybar_tray *tray = data; 40 struct swaybar_tray *tray = data;
@@ -48,13 +48,13 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
48 char *id; 48 char *id;
49 int ret = sd_bus_message_read(msg, "s", &id); 49 int ret = sd_bus_message_read(msg, "s", &id);
50 if (ret < 0) { 50 if (ret < 0) {
51 wlr_log(WLR_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret)); 51 sway_log(SWAY_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret));
52 } 52 }
53 53
54 struct swaybar_tray *tray = data; 54 struct swaybar_tray *tray = data;
55 int idx = list_seq_find(tray->items, cmp_sni_id, id); 55 int idx = list_seq_find(tray->items, cmp_sni_id, id);
56 if (idx != -1) { 56 if (idx != -1) {
57 wlr_log(WLR_INFO, "Unregistering Status Notifier Item '%s'", id); 57 sway_log(SWAY_INFO, "Unregistering Status Notifier Item '%s'", id);
58 destroy_sni(tray->items->items[idx]); 58 destroy_sni(tray->items->items[idx]);
59 list_del(tray->items, idx); 59 list_del(tray->items, idx);
60 set_bar_dirty(tray->bar); 60 set_bar_dirty(tray->bar);
@@ -66,20 +66,20 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data,
66 sd_bus_error *error) { 66 sd_bus_error *error) {
67 if (sd_bus_message_is_method_error(msg, NULL)) { 67 if (sd_bus_message_is_method_error(msg, NULL)) {
68 sd_bus_error err = *sd_bus_message_get_error(msg); 68 sd_bus_error err = *sd_bus_message_get_error(msg);
69 wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", err.message); 69 sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message);
70 return -sd_bus_error_get_errno(&err); 70 return -sd_bus_error_get_errno(&err);
71 } 71 }
72 72
73 int ret = sd_bus_message_enter_container(msg, 'v', NULL); 73 int ret = sd_bus_message_enter_container(msg, 'v', NULL);
74 if (ret < 0) { 74 if (ret < 0) {
75 wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); 75 sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
76 return ret; 76 return ret;
77 } 77 }
78 78
79 char **ids; 79 char **ids;
80 ret = sd_bus_message_read_strv(msg, &ids); 80 ret = sd_bus_message_read_strv(msg, &ids);
81 if (ret < 0) { 81 if (ret < 0) {
82 wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); 82 sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
83 return ret; 83 return ret;
84 } 84 }
85 85
@@ -99,7 +99,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
99 host->watcher_interface, watcher_path, host->watcher_interface, 99 host->watcher_interface, watcher_path, host->watcher_interface,
100 "RegisterStatusNotifierHost", NULL, NULL, "s", host->service); 100 "RegisterStatusNotifierHost", NULL, NULL, "s", host->service);
101 if (ret < 0) { 101 if (ret < 0) {
102 wlr_log(WLR_ERROR, "Failed to send register call: %s", strerror(-ret)); 102 sway_log(SWAY_ERROR, "Failed to send register call: %s", strerror(-ret));
103 return false; 103 return false;
104 } 104 }
105 105
@@ -109,7 +109,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
109 get_registered_snis_callback, host->tray, "ss", 109 get_registered_snis_callback, host->tray, "ss",
110 host->watcher_interface, "RegisteredStatusNotifierItems"); 110 host->watcher_interface, "RegisteredStatusNotifierItems");
111 if (ret < 0) { 111 if (ret < 0) {
112 wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", strerror(-ret)); 112 sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", strerror(-ret));
113 } 113 }
114 114
115 return ret >= 0; 115 return ret >= 0;
@@ -120,7 +120,7 @@ static int handle_new_watcher(sd_bus_message *msg,
120 char *service, *old_owner, *new_owner; 120 char *service, *old_owner, *new_owner;
121 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 121 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
122 if (ret < 0) { 122 if (ret < 0) {
123 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 123 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
124 return ret; 124 return ret;
125 } 125 }
126 126
@@ -148,7 +148,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
148 watcher_path, host->watcher_interface, 148 watcher_path, host->watcher_interface,
149 "StatusNotifierItemRegistered", handle_sni_registered, tray); 149 "StatusNotifierItemRegistered", handle_sni_registered, tray);
150 if (ret < 0) { 150 if (ret < 0) {
151 wlr_log(WLR_ERROR, "Failed to subscribe to registering events: %s", 151 sway_log(SWAY_ERROR, "Failed to subscribe to registering events: %s",
152 strerror(-ret)); 152 strerror(-ret));
153 goto error; 153 goto error;
154 } 154 }
@@ -156,7 +156,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
156 watcher_path, host->watcher_interface, 156 watcher_path, host->watcher_interface,
157 "StatusNotifierItemUnregistered", handle_sni_unregistered, tray); 157 "StatusNotifierItemUnregistered", handle_sni_unregistered, tray);
158 if (ret < 0) { 158 if (ret < 0) {
159 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 159 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
160 strerror(-ret)); 160 strerror(-ret));
161 goto error; 161 goto error;
162 } 162 }
@@ -165,7 +165,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
165 "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", 165 "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged",
166 handle_new_watcher, host); 166 handle_new_watcher, host);
167 if (ret < 0) { 167 if (ret < 0) {
168 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 168 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
169 strerror(-ret)); 169 strerror(-ret));
170 goto error; 170 goto error;
171 } 171 }
@@ -180,7 +180,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
180 snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid); 180 snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid);
181 ret = sd_bus_request_name(tray->bus, host->service, 0); 181 ret = sd_bus_request_name(tray->bus, host->service, 0);
182 if (ret < 0) { 182 if (ret < 0) {
183 wlr_log(WLR_DEBUG, "Failed to acquire service name: %s", strerror(-ret)); 183 sway_log(SWAY_DEBUG, "Failed to acquire service name: %s", strerror(-ret));
184 goto error; 184 goto error;
185 } 185 }
186 186
@@ -193,7 +193,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
193 sd_bus_slot_set_floating(unreg_slot, 1); 193 sd_bus_slot_set_floating(unreg_slot, 1);
194 sd_bus_slot_set_floating(watcher_slot, 1); 194 sd_bus_slot_set_floating(watcher_slot, 1);
195 195
196 wlr_log(WLR_DEBUG, "Registered %s", host->service); 196 sway_log(SWAY_DEBUG, "Registered %s", host->service);
197 return true; 197 return true;
198error: 198error:
199 sd_bus_slot_unref(reg_slot); 199 sd_bus_slot_unref(reg_slot);
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 15fda631..ed152be5 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -317,7 +317,7 @@ void init_themes(list_t **themes, list_t **basedirs) {
317 list_add(theme_names, theme->name); 317 list_add(theme_names, theme->name);
318 } 318 }
319 char *theme_list = join_list(theme_names, ", "); 319 char *theme_list = join_list(theme_names, ", ");
320 wlr_log(WLR_DEBUG, "Loaded themes: %s", theme_list); 320 sway_log(SWAY_DEBUG, "Loaded themes: %s", theme_list);
321 free(theme_list); 321 free(theme_list);
322 list_free(theme_names); 322 list_free(theme_names);
323} 323}
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c
index 9056331e..39d83b23 100644
--- a/swaybar/tray/item.c
+++ b/swaybar/tray/item.c
@@ -35,12 +35,12 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
35 const char *prop, list_t **dest) { 35 const char *prop, list_t **dest) {
36 int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)"); 36 int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)");
37 if (ret < 0) { 37 if (ret < 0) {
38 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 38 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
39 return ret; 39 return ret;
40 } 40 }
41 41
42 if (sd_bus_message_at_end(msg, 0)) { 42 if (sd_bus_message_at_end(msg, 0)) {
43 wlr_log(WLR_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop); 43 sway_log(SWAY_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop);
44 return ret; 44 return ret;
45 } 45 }
46 46
@@ -52,14 +52,14 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
52 while (!sd_bus_message_at_end(msg, 0)) { 52 while (!sd_bus_message_at_end(msg, 0)) {
53 ret = sd_bus_message_enter_container(msg, 'r', "iiay"); 53 ret = sd_bus_message_enter_container(msg, 'r', "iiay");
54 if (ret < 0) { 54 if (ret < 0) {
55 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 55 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
56 goto error; 56 goto error;
57 } 57 }
58 58
59 int size; 59 int size;
60 ret = sd_bus_message_read(msg, "ii", NULL, &size); 60 ret = sd_bus_message_read(msg, "ii", NULL, &size);
61 if (ret < 0) { 61 if (ret < 0) {
62 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 62 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
63 goto error; 63 goto error;
64 } 64 }
65 65
@@ -67,7 +67,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
67 size_t npixels; 67 size_t npixels;
68 ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels); 68 ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels);
69 if (ret < 0) { 69 if (ret < 0) {
70 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 70 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
71 goto error; 71 goto error;
72 } 72 }
73 73
@@ -81,7 +81,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
81 } 81 }
82 list_free_items_and_destroy(*dest); 82 list_free_items_and_destroy(*dest);
83 *dest = pixmaps; 83 *dest = pixmaps;
84 wlr_log(WLR_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop, 84 sway_log(SWAY_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop,
85 pixmaps->length); 85 pixmaps->length);
86 86
87 return ret; 87 return ret;
@@ -107,7 +107,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
107 107
108 int ret; 108 int ret;
109 if (sd_bus_message_is_method_error(msg, NULL)) { 109 if (sd_bus_message_is_method_error(msg, NULL)) {
110 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, 110 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop,
111 sd_bus_message_get_error(msg)->message); 111 sd_bus_message_get_error(msg)->message);
112 ret = sd_bus_message_get_errno(msg); 112 ret = sd_bus_message_get_errno(msg);
113 goto cleanup; 113 goto cleanup;
@@ -115,7 +115,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
115 115
116 ret = sd_bus_message_enter_container(msg, 'v', type); 116 ret = sd_bus_message_enter_container(msg, 'v', type);
117 if (ret < 0) { 117 if (ret < 0) {
118 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 118 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
119 goto cleanup; 119 goto cleanup;
120 } 120 }
121 121
@@ -131,16 +131,16 @@ static int get_property_callback(sd_bus_message *msg, void *data,
131 131
132 ret = sd_bus_message_read(msg, type, dest); 132 ret = sd_bus_message_read(msg, type, dest);
133 if (ret < 0) { 133 if (ret < 0) {
134 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 134 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
135 goto cleanup; 135 goto cleanup;
136 } 136 }
137 137
138 if (*type == 's' || *type == 'o') { 138 if (*type == 's' || *type == 'o') {
139 char **str = dest; 139 char **str = dest;
140 *str = strdup(*str); 140 *str = strdup(*str);
141 wlr_log(WLR_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str); 141 sway_log(SWAY_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str);
142 } else if (*type == 'b') { 142 } else if (*type == 'b') {
143 wlr_log(WLR_DEBUG, "%s %s = %s", sni->watcher_id, prop, 143 sway_log(SWAY_DEBUG, "%s %s = %s", sni->watcher_id, prop,
144 *(bool *)dest ? "true" : "false"); 144 *(bool *)dest ? "true" : "false");
145 } 145 }
146 } 146 }
@@ -165,7 +165,7 @@ static void sni_get_property_async(struct swaybar_sni *sni, const char *prop,
165 sni->path, "org.freedesktop.DBus.Properties", "Get", 165 sni->path, "org.freedesktop.DBus.Properties", "Get",
166 get_property_callback, data, "ss", sni->interface, prop); 166 get_property_callback, data, "ss", sni->interface, prop);
167 if (ret < 0) { 167 if (ret < 0) {
168 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 168 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
169 } 169 }
170} 170}
171 171
@@ -188,10 +188,10 @@ static int sni_check_msg_sender(struct swaybar_sni *sni, sd_bus_message *msg,
188 bool has_well_known_names = 188 bool has_well_known_names =
189 sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES; 189 sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES;
190 if (sni->service[0] == ':' || has_well_known_names) { 190 if (sni->service[0] == ':' || has_well_known_names) {
191 wlr_log(WLR_DEBUG, "%s has new %s", sni->watcher_id, signal); 191 sway_log(SWAY_DEBUG, "%s has new %s", sni->watcher_id, signal);
192 return 1; 192 return 1;
193 } else { 193 } else {
194 wlr_log(WLR_DEBUG, "%s may have new %s", sni->watcher_id, signal); 194 sway_log(SWAY_DEBUG, "%s may have new %s", sni->watcher_id, signal);
195 return 0; 195 return 0;
196 } 196 }
197} 197}
@@ -218,12 +218,12 @@ static int handle_new_status(sd_bus_message *msg, void *data, sd_bus_error *erro
218 char *status; 218 char *status;
219 int r = sd_bus_message_read(msg, "s", &status); 219 int r = sd_bus_message_read(msg, "s", &status);
220 if (r < 0) { 220 if (r < 0) {
221 wlr_log(WLR_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret)); 221 sway_log(SWAY_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret));
222 ret = r; 222 ret = r;
223 } else { 223 } else {
224 free(sni->status); 224 free(sni->status);
225 sni->status = strdup(status); 225 sni->status = strdup(status);
226 wlr_log(WLR_DEBUG, "%s has new status = '%s'", sni->watcher_id, status); 226 sway_log(SWAY_DEBUG, "%s has new status = '%s'", sni->watcher_id, status);
227 set_sni_dirty(sni); 227 set_sni_dirty(sni);
228 } 228 }
229 } else { 229 } else {
@@ -238,7 +238,7 @@ static void sni_match_signal(struct swaybar_sni *sni, sd_bus_slot **slot,
238 int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path, 238 int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path,
239 sni->interface, signal, callback, sni); 239 sni->interface, signal, callback, sni);
240 if (ret < 0) { 240 if (ret < 0) {
241 wlr_log(WLR_ERROR, "Failed to subscribe to signal %s: %s", signal, 241 sway_log(SWAY_ERROR, "Failed to subscribe to signal %s: %s", signal,
242 strerror(-ret)); 242 strerror(-ret));
243 } 243 }
244} 244}
@@ -353,7 +353,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
353static enum hotspot_event_handling icon_hotspot_callback( 353static enum hotspot_event_handling icon_hotspot_callback(
354 struct swaybar_output *output, struct swaybar_hotspot *hotspot, 354 struct swaybar_output *output, struct swaybar_hotspot *hotspot,
355 int x, int y, uint32_t button, void *data) { 355 int x, int y, uint32_t button, void *data) {
356 wlr_log(WLR_DEBUG, "Clicked on %s", (char *)data); 356 sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data);
357 357
358 struct swaybar_tray *tray = output->bar->tray; 358 struct swaybar_tray *tray = output->bar->tray;
359 int idx = list_seq_find(tray->items, cmp_sni_id, data); 359 int idx = list_seq_find(tray->items, cmp_sni_id, data);
@@ -367,11 +367,11 @@ static enum hotspot_event_handling icon_hotspot_callback(
367 int global_y = output->output_y + (top_bar ? config->gaps.top + y: 367 int global_y = output->output_y + (top_bar ? config->gaps.top + y:
368 (int) output->output_height - config->gaps.bottom - y); 368 (int) output->output_height - config->gaps.bottom - y);
369 369
370 wlr_log(WLR_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y); 370 sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
371 handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event 371 handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event
372 return HOTSPOT_IGNORE; 372 return HOTSPOT_IGNORE;
373 } else { 373 } else {
374 wlr_log(WLR_DEBUG, "but it doesn't exist"); 374 sway_log(SWAY_DEBUG, "but it doesn't exist");
375 } 375 }
376 376
377 return HOTSPOT_PROCESS; 377 return HOTSPOT_PROCESS;
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index d5d0c84e..fcf8114f 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -17,7 +17,7 @@ static int handle_lost_watcher(sd_bus_message *msg,
17 char *service, *old_owner, *new_owner; 17 char *service, *old_owner, *new_owner;
18 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 18 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
19 if (ret < 0) { 19 if (ret < 0) {
20 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 20 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
21 return ret; 21 return ret;
22 } 22 }
23 23
@@ -34,12 +34,12 @@ static int handle_lost_watcher(sd_bus_message *msg,
34} 34}
35 35
36struct swaybar_tray *create_tray(struct swaybar *bar) { 36struct swaybar_tray *create_tray(struct swaybar *bar) {
37 wlr_log(WLR_DEBUG, "Initializing tray"); 37 sway_log(SWAY_DEBUG, "Initializing tray");
38 38
39 sd_bus *bus; 39 sd_bus *bus;
40 int ret = sd_bus_open_user(&bus); 40 int ret = sd_bus_open_user(&bus);
41 if (ret < 0) { 41 if (ret < 0) {
42 wlr_log(WLR_ERROR, "Failed to connect to user bus: %s", strerror(-ret)); 42 sway_log(SWAY_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
43 return NULL; 43 return NULL;
44 } 44 }
45 45
@@ -58,7 +58,7 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
58 "/org/freedesktop/DBus", "org.freedesktop.DBus", 58 "/org/freedesktop/DBus", "org.freedesktop.DBus",
59 "NameOwnerChanged", handle_lost_watcher, tray); 59 "NameOwnerChanged", handle_lost_watcher, tray);
60 if (ret < 0) { 60 if (ret < 0) {
61 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 61 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
62 strerror(-ret)); 62 strerror(-ret));
63 } 63 }
64 64
@@ -96,7 +96,7 @@ void tray_in(int fd, short mask, void *data) {
96 // This space intentionally left blank 96 // This space intentionally left blank
97 } 97 }
98 if (ret < 0) { 98 if (ret < 0) {
99 wlr_log(WLR_ERROR, "Failed to process bus: %s", strerror(-ret)); 99 sway_log(SWAY_ERROR, "Failed to process bus: %s", strerror(-ret));
100 } 100 }
101} 101}
102 102
diff --git a/swaybar/tray/watcher.c b/swaybar/tray/watcher.c
index 198c6c85..68052ed9 100644
--- a/swaybar/tray/watcher.c
+++ b/swaybar/tray/watcher.c
@@ -27,7 +27,7 @@ static int handle_lost_service(sd_bus_message *msg,
27 char *service, *old_owner, *new_owner; 27 char *service, *old_owner, *new_owner;
28 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 28 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
29 if (ret < 0) { 29 if (ret < 0) {
30 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 30 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
31 return ret; 31 return ret;
32 } 32 }
33 33
@@ -37,7 +37,7 @@ static int handle_lost_service(sd_bus_message *msg,
37 using_standard_protocol(watcher) ? cmp_id : cmp_service, service); 37 using_standard_protocol(watcher) ? cmp_id : cmp_service, service);
38 if (idx != -1) { 38 if (idx != -1) {
39 char *id = watcher->items->items[idx]; 39 char *id = watcher->items->items[idx];
40 wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id); 40 sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id);
41 list_del(watcher->items, idx); 41 list_del(watcher->items, idx);
42 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 42 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
43 "StatusNotifierItemUnregistered", "s", id); 43 "StatusNotifierItemUnregistered", "s", id);
@@ -46,7 +46,7 @@ static int handle_lost_service(sd_bus_message *msg,
46 46
47 idx = list_seq_find(watcher->hosts, cmp_id, service); 47 idx = list_seq_find(watcher->hosts, cmp_id, service);
48 if (idx != -1) { 48 if (idx != -1) {
49 wlr_log(WLR_DEBUG, "Unregistering Status Notifier Host '%s'", service); 49 sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service);
50 free(watcher->hosts->items[idx]); 50 free(watcher->hosts->items[idx]);
51 list_del(watcher->hosts, idx); 51 list_del(watcher->hosts, idx);
52 } 52 }
@@ -59,7 +59,7 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
59 char *service_or_path, *id; 59 char *service_or_path, *id;
60 int ret = sd_bus_message_read(msg, "s", &service_or_path); 60 int ret = sd_bus_message_read(msg, "s", &service_or_path);
61 if (ret < 0) { 61 if (ret < 0) {
62 wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); 62 sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
63 return ret; 63 return ret;
64 } 64 }
65 65
@@ -81,12 +81,12 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
81 } 81 }
82 82
83 if (list_seq_find(watcher->items, cmp_id, id) == -1) { 83 if (list_seq_find(watcher->items, cmp_id, id) == -1) {
84 wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id); 84 sway_log(SWAY_DEBUG, "Registering Status Notifier Item '%s'", id);
85 list_add(watcher->items, id); 85 list_add(watcher->items, id);
86 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 86 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
87 "StatusNotifierItemRegistered", "s", id); 87 "StatusNotifierItemRegistered", "s", id);
88 } else { 88 } else {
89 wlr_log(WLR_DEBUG, "Status Notifier Item '%s' already registered", id); 89 sway_log(SWAY_DEBUG, "Status Notifier Item '%s' already registered", id);
90 free(id); 90 free(id);
91 } 91 }
92 92
@@ -97,18 +97,18 @@ static int register_host(sd_bus_message *msg, void *data, sd_bus_error *error) {
97 char *service; 97 char *service;
98 int ret = sd_bus_message_read(msg, "s", &service); 98 int ret = sd_bus_message_read(msg, "s", &service);
99 if (ret < 0) { 99 if (ret < 0) {
100 wlr_log(WLR_ERROR, "Failed to parse register host message: %s", strerror(-ret)); 100 sway_log(SWAY_ERROR, "Failed to parse register host message: %s", strerror(-ret));
101 return ret; 101 return ret;
102 } 102 }
103 103
104 struct swaybar_watcher *watcher = data; 104 struct swaybar_watcher *watcher = data;
105 if (list_seq_find(watcher->hosts, cmp_id, service) == -1) { 105 if (list_seq_find(watcher->hosts, cmp_id, service) == -1) {
106 wlr_log(WLR_DEBUG, "Registering Status Notifier Host '%s'", service); 106 sway_log(SWAY_DEBUG, "Registering Status Notifier Host '%s'", service);
107 list_add(watcher->hosts, strdup(service)); 107 list_add(watcher->hosts, strdup(service));
108 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 108 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
109 "StatusNotifierHostRegistered", "s", service); 109 "StatusNotifierHostRegistered", "s", service);
110 } else { 110 } else {
111 wlr_log(WLR_DEBUG, "Status Notifier Host '%s' already registered", service); 111 sway_log(SWAY_DEBUG, "Status Notifier Host '%s' already registered", service);
112 } 112 }
113 113
114 return sd_bus_reply_method_return(msg, ""); 114 return sd_bus_reply_method_return(msg, "");
@@ -166,7 +166,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
166 int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path, 166 int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path,
167 watcher->interface, watcher_vtable, watcher); 167 watcher->interface, watcher_vtable, watcher);
168 if (ret < 0) { 168 if (ret < 0) {
169 wlr_log(WLR_ERROR, "Failed to add object vtable: %s", strerror(-ret)); 169 sway_log(SWAY_ERROR, "Failed to add object vtable: %s", strerror(-ret));
170 goto error; 170 goto error;
171 } 171 }
172 172
@@ -174,14 +174,14 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
174 "/org/freedesktop/DBus", "org.freedesktop.DBus", 174 "/org/freedesktop/DBus", "org.freedesktop.DBus",
175 "NameOwnerChanged", handle_lost_service, watcher); 175 "NameOwnerChanged", handle_lost_service, watcher);
176 if (ret < 0) { 176 if (ret < 0) {
177 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 177 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
178 strerror(-ret)); 178 strerror(-ret));
179 goto error; 179 goto error;
180 } 180 }
181 181
182 ret = sd_bus_request_name(bus, watcher->interface, 0); 182 ret = sd_bus_request_name(bus, watcher->interface, 0);
183 if (ret < 0) { 183 if (ret < 0) {
184 wlr_log(WLR_ERROR, "Failed to acquire service name: %s", strerror(-ret)); 184 sway_log(SWAY_ERROR, "Failed to acquire service name: %s", strerror(-ret));
185 goto error; 185 goto error;
186 } 186 }
187 187
@@ -192,7 +192,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
192 watcher->hosts = create_list(); 192 watcher->hosts = create_list();
193 watcher->items = create_list(); 193 watcher->items = create_list();
194 watcher->version = 0; 194 watcher->version = 0;
195 wlr_log(WLR_DEBUG, "Registered %s", watcher->interface); 195 sway_log(SWAY_DEBUG, "Registered %s", watcher->interface);
196 return watcher; 196 return watcher;
197error: 197error:
198 sd_bus_slot_unref(signal_slot); 198 sd_bus_slot_unref(signal_slot);
diff --git a/swaybg/main.c b/swaybg/main.c
index 5678a671..e66221f0 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -6,9 +6,9 @@
6#include <string.h> 6#include <string.h>
7#include <time.h> 7#include <time.h>
8#include <wayland-client.h> 8#include <wayland-client.h>
9#include <wlr/util/log.h>
10#include "background-image.h" 9#include "background-image.h"
11#include "cairo.h" 10#include "cairo.h"
11#include "log.h"
12#include "pool-buffer.h" 12#include "pool-buffer.h"
13#include "util.h" 13#include "util.h"
14#include "wlr-layer-shell-unstable-v1-client-protocol.h" 14#include "wlr-layer-shell-unstable-v1-client-protocol.h"
@@ -62,7 +62,7 @@ struct swaybg_state {
62bool is_valid_color(const char *color) { 62bool is_valid_color(const char *color) {
63 int len = strlen(color); 63 int len = strlen(color);
64 if (len != 7 || color[0] != '#') { 64 if (len != 7 || color[0] != '#') {
65 wlr_log(WLR_ERROR, "%s is not a valid color for swaybg. " 65 sway_log(SWAY_ERROR, "%s is not a valid color for swaybg. "
66 "Color should be specified as #rrggbb (no alpha).", color); 66 "Color should be specified as #rrggbb (no alpha).", color);
67 return false; 67 return false;
68 } 68 }
@@ -253,14 +253,14 @@ static const struct wl_registry_listener registry_listener = {
253}; 253};
254 254
255int main(int argc, const char **argv) { 255int main(int argc, const char **argv) {
256 wlr_log_init(WLR_DEBUG, NULL); 256 sway_log_init(SWAY_DEBUG, NULL);
257 257
258 struct swaybg_args args = {0}; 258 struct swaybg_args args = {0};
259 struct swaybg_state state = { .args = &args }; 259 struct swaybg_state state = { .args = &args };
260 wl_list_init(&state.outputs); 260 wl_list_init(&state.outputs);
261 261
262 if (argc < 4 || argc > 5) { 262 if (argc < 4 || argc > 5) {
263 wlr_log(WLR_ERROR, "Do not run this program manually. " 263 sway_log(SWAY_ERROR, "Do not run this program manually. "
264 "See `man 5 sway-output` and look for background options."); 264 "See `man 5 sway-output` and look for background options.");
265 return 1; 265 return 1;
266 } 266 }
@@ -281,7 +281,7 @@ int main(int argc, const char **argv) {
281 281
282 state.display = wl_display_connect(NULL); 282 state.display = wl_display_connect(NULL);
283 if (!state.display) { 283 if (!state.display) {
284 wlr_log(WLR_ERROR, "Unable to connect to the compositor. " 284 sway_log(SWAY_ERROR, "Unable to connect to the compositor. "
285 "If your compositor is running, check or set the " 285 "If your compositor is running, check or set the "
286 "WAYLAND_DISPLAY environment variable."); 286 "WAYLAND_DISPLAY environment variable.");
287 return 1; 287 return 1;
@@ -292,7 +292,7 @@ int main(int argc, const char **argv) {
292 wl_display_roundtrip(state.display); 292 wl_display_roundtrip(state.display);
293 if (state.compositor == NULL || state.shm == NULL || 293 if (state.compositor == NULL || state.shm == NULL ||
294 state.layer_shell == NULL || state.xdg_output_manager == NULL) { 294 state.layer_shell == NULL || state.xdg_output_manager == NULL) {
295 wlr_log(WLR_ERROR, "Missing a required Wayland interface"); 295 sway_log(SWAY_ERROR, "Missing a required Wayland interface");
296 return 1; 296 return 1;
297 } 297 }
298 298
@@ -306,7 +306,7 @@ int main(int argc, const char **argv) {
306 // Second roundtrip to get xdg_output properties 306 // Second roundtrip to get xdg_output properties
307 wl_display_roundtrip(state.display); 307 wl_display_roundtrip(state.display);
308 if (state.output == NULL) { 308 if (state.output == NULL) {
309 wlr_log(WLR_ERROR, "Cannot find output '%s'", args.output); 309 sway_log(SWAY_ERROR, "Cannot find output '%s'", args.output);
310 return 1; 310 return 1;
311 } 311 }
312 312
diff --git a/swaymsg/main.c b/swaymsg/main.c
index e5eee631..2b49f9b9 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -317,7 +317,7 @@ int main(int argc, char **argv) {
317 char *socket_path = NULL; 317 char *socket_path = NULL;
318 char *cmdtype = NULL; 318 char *cmdtype = NULL;
319 319
320 wlr_log_init(WLR_INFO, NULL); 320 sway_log_init(SWAY_INFO, NULL);
321 321
322 static struct option long_options[] = { 322 static struct option long_options[] = {
323 {"help", no_argument, NULL, 'h'}, 323 {"help", no_argument, NULL, 'h'},
@@ -421,7 +421,7 @@ int main(int argc, char **argv) {
421 free(cmdtype); 421 free(cmdtype);
422 422
423 if (monitor && type != IPC_SUBSCRIBE) { 423 if (monitor && type != IPC_SUBSCRIBE) {
424 wlr_log(WLR_ERROR, "Monitor can only be used with -t SUBSCRIBE"); 424 sway_log(SWAY_ERROR, "Monitor can only be used with -t SUBSCRIBE");
425 free(socket_path); 425 free(socket_path);
426 return 1; 426 return 1;
427 } 427 }
diff --git a/swaynag/main.c b/swaynag/main.c
index 9f00ac7e..4a785f40 100644
--- a/swaynag/main.c
+++ b/swaynag/main.c
@@ -47,13 +47,13 @@ int main(int argc, char **argv) {
47 exit_code = launch_status; 47 exit_code = launch_status;
48 goto cleanup; 48 goto cleanup;
49 } 49 }
50 wlr_log_init(debug ? WLR_DEBUG : WLR_ERROR, NULL); 50 sway_log_init(debug ? SWAY_DEBUG : SWAY_ERROR, NULL);
51 51
52 if (!config_path) { 52 if (!config_path) {
53 config_path = swaynag_get_config_path(); 53 config_path = swaynag_get_config_path();
54 } 54 }
55 if (config_path) { 55 if (config_path) {
56 wlr_log(WLR_DEBUG, "Loading config file: %s", config_path); 56 sway_log(SWAY_DEBUG, "Loading config file: %s", config_path);
57 int config_status = swaynag_load_config(config_path, &swaynag, types); 57 int config_status = swaynag_load_config(config_path, &swaynag, types);
58 free(config_path); 58 free(config_path);
59 if (config_status != 0) { 59 if (config_status != 0) {
@@ -77,7 +77,7 @@ int main(int argc, char **argv) {
77 } 77 }
78 78
79 if (!swaynag.message) { 79 if (!swaynag.message) {
80 wlr_log(WLR_ERROR, "No message passed. Please provide --message/-m"); 80 sway_log(SWAY_ERROR, "No message passed. Please provide --message/-m");
81 exit_code = EXIT_FAILURE; 81 exit_code = EXIT_FAILURE;
82 goto cleanup; 82 goto cleanup;
83 } 83 }
@@ -106,15 +106,15 @@ int main(int argc, char **argv) {
106 free(swaynag.details.button_details); 106 free(swaynag.details.button_details);
107 } 107 }
108 108
109 wlr_log(WLR_DEBUG, "Output: %s", swaynag.type->output); 109 sway_log(SWAY_DEBUG, "Output: %s", swaynag.type->output);
110 wlr_log(WLR_DEBUG, "Anchors: %d", swaynag.type->anchors); 110 sway_log(SWAY_DEBUG, "Anchors: %d", swaynag.type->anchors);
111 wlr_log(WLR_DEBUG, "Type: %s", swaynag.type->name); 111 sway_log(SWAY_DEBUG, "Type: %s", swaynag.type->name);
112 wlr_log(WLR_DEBUG, "Message: %s", swaynag.message); 112 sway_log(SWAY_DEBUG, "Message: %s", swaynag.message);
113 wlr_log(WLR_DEBUG, "Font: %s", swaynag.type->font); 113 sway_log(SWAY_DEBUG, "Font: %s", swaynag.type->font);
114 wlr_log(WLR_DEBUG, "Buttons"); 114 sway_log(SWAY_DEBUG, "Buttons");
115 for (int i = 0; i < swaynag.buttons->length; i++) { 115 for (int i = 0; i < swaynag.buttons->length; i++) {
116 struct swaynag_button *button = swaynag.buttons->items[i]; 116 struct swaynag_button *button = swaynag.buttons->items[i];
117 wlr_log(WLR_DEBUG, "\t[%s] `%s`", button->text, button->action); 117 sway_log(SWAY_DEBUG, "\t[%s] `%s`", button->text, button->action);
118 } 118 }
119 119
120 signal(SIGTERM, sig_handler); 120 signal(SIGTERM, sig_handler);
diff --git a/swaynag/render.c b/swaynag/render.c
index 7db9fe60..661e27a1 100644
--- a/swaynag/render.c
+++ b/swaynag/render.c
@@ -281,7 +281,7 @@ void render_frame(struct swaynag *swaynag) {
281 swaynag->width * swaynag->scale, 281 swaynag->width * swaynag->scale,
282 swaynag->height * swaynag->scale); 282 swaynag->height * swaynag->scale);
283 if (!swaynag->current_buffer) { 283 if (!swaynag->current_buffer) {
284 wlr_log(WLR_DEBUG, "Failed to get buffer. Skipping frame."); 284 sway_log(SWAY_DEBUG, "Failed to get buffer. Skipping frame.");
285 goto cleanup; 285 goto cleanup;
286 } 286 }
287 287
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
index 186e9011..f0c6a3c5 100644
--- a/swaynag/swaynag.c
+++ b/swaynag/swaynag.c
@@ -21,24 +21,24 @@ static bool terminal_execute(char *terminal, char *command) {
21 char fname[] = "/tmp/swaynagXXXXXX"; 21 char fname[] = "/tmp/swaynagXXXXXX";
22 FILE *tmp= fdopen(mkstemp(fname), "w"); 22 FILE *tmp= fdopen(mkstemp(fname), "w");
23 if (!tmp) { 23 if (!tmp) {
24 wlr_log(WLR_ERROR, "Failed to create temp script"); 24 sway_log(SWAY_ERROR, "Failed to create temp script");
25 return false; 25 return false;
26 } 26 }
27 wlr_log(WLR_DEBUG, "Created temp script: %s", fname); 27 sway_log(SWAY_DEBUG, "Created temp script: %s", fname);
28 fprintf(tmp, "#!/bin/sh\nrm %s\n%s", fname, command); 28 fprintf(tmp, "#!/bin/sh\nrm %s\n%s", fname, command);
29 fclose(tmp); 29 fclose(tmp);
30 chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR); 30 chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
31 char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1)); 31 char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
32 sprintf(cmd, "%s -e %s", terminal, fname); 32 sprintf(cmd, "%s -e %s", terminal, fname);
33 execl("/bin/sh", "/bin/sh", "-c", cmd, NULL); 33 execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
34 wlr_log_errno(WLR_ERROR, "Failed to run command, execl() returned."); 34 sway_log_errno(SWAY_ERROR, "Failed to run command, execl() returned.");
35 free(cmd); 35 free(cmd);
36 return false; 36 return false;
37} 37}
38 38
39static void swaynag_button_execute(struct swaynag *swaynag, 39static void swaynag_button_execute(struct swaynag *swaynag,
40 struct swaynag_button *button) { 40 struct swaynag_button *button) {
41 wlr_log(WLR_DEBUG, "Executing [%s]: %s", button->text, button->action); 41 sway_log(SWAY_DEBUG, "Executing [%s]: %s", button->text, button->action);
42 if (button->type == SWAYNAG_ACTION_DISMISS) { 42 if (button->type == SWAYNAG_ACTION_DISMISS) {
43 swaynag->run_display = false; 43 swaynag->run_display = false;
44 } else if (button->type == SWAYNAG_ACTION_EXPAND) { 44 } else if (button->type == SWAYNAG_ACTION_EXPAND) {
@@ -52,14 +52,14 @@ static void swaynag_button_execute(struct swaynag *swaynag,
52 // Child of the child. Will be reparented to the init process 52 // Child of the child. Will be reparented to the init process
53 char *terminal = getenv("TERMINAL"); 53 char *terminal = getenv("TERMINAL");
54 if (button->terminal && terminal && strlen(terminal)) { 54 if (button->terminal && terminal && strlen(terminal)) {
55 wlr_log(WLR_DEBUG, "Found $TERMINAL: %s", terminal); 55 sway_log(SWAY_DEBUG, "Found $TERMINAL: %s", terminal);
56 if (!terminal_execute(terminal, button->action)) { 56 if (!terminal_execute(terminal, button->action)) {
57 swaynag_destroy(swaynag); 57 swaynag_destroy(swaynag);
58 exit(EXIT_FAILURE); 58 exit(EXIT_FAILURE);
59 } 59 }
60 } else { 60 } else {
61 if (button->terminal) { 61 if (button->terminal) {
62 wlr_log(WLR_DEBUG, 62 sway_log(SWAY_DEBUG,
63 "$TERMINAL not found. Running directly"); 63 "$TERMINAL not found. Running directly");
64 } 64 }
65 execl("/bin/sh", "/bin/sh", "-c", button->action, NULL); 65 execl("/bin/sh", "/bin/sh", "-c", button->action, NULL);
@@ -98,7 +98,7 @@ static void surface_enter(void *data, struct wl_surface *surface,
98 struct swaynag_output *swaynag_output; 98 struct swaynag_output *swaynag_output;
99 wl_list_for_each(swaynag_output, &swaynag->outputs, link) { 99 wl_list_for_each(swaynag_output, &swaynag->outputs, link) {
100 if (swaynag_output->wl_output == output) { 100 if (swaynag_output->wl_output == output) {
101 wlr_log(WLR_DEBUG, "Surface enter on output %s", 101 sway_log(SWAY_DEBUG, "Surface enter on output %s",
102 swaynag_output->name); 102 swaynag_output->name);
103 swaynag->output = swaynag_output; 103 swaynag->output = swaynag_output;
104 swaynag->scale = swaynag->output->scale; 104 swaynag->scale = swaynag->output->scale;
@@ -273,10 +273,10 @@ static void xdg_output_handle_name(void *data,
273 struct zxdg_output_v1 *xdg_output, const char *name) { 273 struct zxdg_output_v1 *xdg_output, const char *name) {
274 struct swaynag_output *swaynag_output = data; 274 struct swaynag_output *swaynag_output = data;
275 char *outname = swaynag_output->swaynag->type->output; 275 char *outname = swaynag_output->swaynag->type->output;
276 wlr_log(WLR_DEBUG, "Checking against output %s for %s", name, outname); 276 sway_log(SWAY_DEBUG, "Checking against output %s for %s", name, outname);
277 if (!swaynag_output->swaynag->output && outname && name 277 if (!swaynag_output->swaynag->output && outname && name
278 && strcmp(outname, name) == 0) { 278 && strcmp(outname, name) == 0) {
279 wlr_log(WLR_DEBUG, "Using output %s", name); 279 sway_log(SWAY_DEBUG, "Using output %s", name);
280 swaynag_output->swaynag->output = swaynag_output; 280 swaynag_output->swaynag->output = swaynag_output;
281 } 281 }
282 swaynag_output->name = strdup(name); 282 swaynag_output->name = strdup(name);
@@ -368,7 +368,7 @@ void swaynag_setup(struct swaynag *swaynag) {
368 } 368 }
369 369
370 if (!swaynag->output && swaynag->type->output) { 370 if (!swaynag->output && swaynag->type->output) {
371 wlr_log(WLR_ERROR, "Output '%s' not found", swaynag->type->output); 371 sway_log(SWAY_ERROR, "Output '%s' not found", swaynag->type->output);
372 swaynag_destroy(swaynag); 372 swaynag_destroy(swaynag);
373 exit(EXIT_FAILURE); 373 exit(EXIT_FAILURE);
374 } 374 }