aboutsummaryrefslogtreecommitdiff
path: root/swaybar
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar')
-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
13 files changed, 88 insertions, 91 deletions
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 @@
#include <unistd.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
-#include <wlr/util/log.h>
#include "config.h"
#include "swaybar/bar.h"
#include "swaybar/config.h"
@@ -44,7 +43,7 @@ static void swaybar_output_free(struct swaybar_output *output) {
if (!output) {
return;
}
- wlr_log(WLR_DEBUG, "Removing output %s", output->name);
+ sway_log(SWAY_DEBUG, "Removing output %s", output->name);
if (output->layer_surface != NULL) {
zwlr_layer_surface_v1_destroy(output->layer_surface);
}
@@ -157,7 +156,7 @@ bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) {
bar->visible = visible;
if (bar->status) {
- wlr_log(WLR_DEBUG, "Sending %s signal to status command",
+ sway_log(SWAY_DEBUG, "Sending %s signal to status command",
visible ? "cont" : "stop");
kill(bar->status->pid, visible ?
bar->status->cont_signal : bar->status->stop_signal);
@@ -271,7 +270,7 @@ static void xdg_output_handle_description(void *data,
size_t length = paren - description;
output->identifier = malloc(length);
if (!output->identifier) {
- wlr_log(WLR_ERROR, "Failed to allocate output identifier");
+ sway_log(SWAY_ERROR, "Failed to allocate output identifier");
return;
}
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 @@
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
-#include <wlr/util/log.h>
#include "swaybar/config.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "config.h"
#include "stringop.h"
#include "list.h"
+#include "log.h"
uint32_t parse_position(const char *position) {
uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
@@ -16,7 +16,7 @@ uint32_t parse_position(const char *position) {
} else if (strcmp("bottom", position) == 0) {
return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
} else {
- wlr_log(WLR_ERROR, "Invalid position: %s, defaulting to bottom", position);
+ sway_log(SWAY_ERROR, "Invalid position: %s, defaulting to bottom", position);
return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz;
}
}
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 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <wlr/util/log.h>
+#include "log.h"
#include "swaybar/bar.h"
#include "swaybar/config.h"
#include "swaybar/i3bar.h"
@@ -120,7 +120,7 @@ bool i3bar_handle_readable(struct status_line *status) {
memmove(status->buffer, &status->buffer[c], status->buffer_index);
break;
} else if (!isspace(status->buffer[c])) {
- wlr_log(WLR_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'",
+ sway_log(SWAY_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'",
status->buffer[c]);
status_error(status, "[invalid i3bar json]");
return true;
@@ -160,7 +160,7 @@ bool i3bar_handle_readable(struct status_line *status) {
++buffer_pos;
break;
} else if (!isspace(status->buffer[buffer_pos])) {
- wlr_log(WLR_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'",
+ sway_log(SWAY_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'",
status->buffer[buffer_pos]);
status_error(status, "[invalid i3bar json]");
return true;
@@ -195,7 +195,7 @@ bool i3bar_handle_readable(struct status_line *status) {
}
*last_char_pos = '\0';
size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v");
- wlr_log(WLR_DEBUG, "Received i3bar json: '%s%c'",
+ sway_log(SWAY_DEBUG, "Received i3bar json: '%s%c'",
&status->buffer[buffer_pos + offset], last_char);
*last_char_pos = last_char;
@@ -229,7 +229,7 @@ bool i3bar_handle_readable(struct status_line *status) {
} else {
char last_char = status->buffer[status->buffer_index - 1];
status->buffer[status->buffer_index - 1] = '\0';
- wlr_log(WLR_DEBUG, "Failed to parse i3bar json - %s: '%s%c'",
+ sway_log(SWAY_DEBUG, "Failed to parse i3bar json - %s: '%s%c'",
json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char);
status_error(status, "[failed to parse i3bar json]");
return true;
@@ -250,7 +250,7 @@ bool i3bar_handle_readable(struct status_line *status) {
}
if (last_object) {
- wlr_log(WLR_DEBUG, "Rendering last received json");
+ sway_log(SWAY_DEBUG, "Rendering last received json");
i3bar_parse_json(status, last_object);
json_object_put(last_object);
return true;
@@ -262,7 +262,7 @@ bool i3bar_handle_readable(struct status_line *status) {
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h,
uint32_t button) {
- wlr_log(WLR_DEBUG, "block %s clicked", block->name);
+ sway_log(SWAY_DEBUG, "block %s clicked", block->name);
if (!block->name || !status->click_events) {
return HOTSPOT_PROCESS;
}
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 @@
#include <stdlib.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
-#include <wlr/util/log.h>
#include "list.h"
#include "log.h"
#include "swaybar/bar.h"
@@ -55,7 +54,7 @@ static uint32_t wl_axis_to_button(uint32_t axis, wl_fixed_t value) {
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
return negative ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT;
default:
- wlr_log(WLR_DEBUG, "Unexpected axis value on mouse scroll");
+ sway_log(SWAY_DEBUG, "Unexpected axis value on mouse scroll");
return 0;
}
}
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 @@
#include <string.h>
#include <strings.h>
#include <json-c/json.h>
-#include <wlr/util/log.h>
#include "swaybar/config.h"
#include "swaybar/ipc.h"
#include "config.h"
#include "ipc-client.h"
#include "list.h"
+#include "log.h"
void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
const char *fmt = "workspace \"%s\"";
@@ -150,7 +150,7 @@ static bool ipc_parse_config(
json_object *success;
if (json_object_object_get_ex(bar_config, "success", &success)
&& !json_object_get_boolean(success)) {
- wlr_log(WLR_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs.");
+ sway_log(SWAY_ERROR, "No bar with that ID. Use 'swaymsg -t get_bar_config to get the available bar configs.");
json_object_put(bar_config);
return false;
}
@@ -441,7 +441,7 @@ static void ipc_get_outputs(struct swaybar *bar) {
}
void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) {
- wlr_log(WLR_DEBUG, "Executing binding for button %u (release=%d): `%s`",
+ sway_log(SWAY_DEBUG, "Executing binding for button %u (release=%d): `%s`",
bind->button, bind->release, bind->command);
uint32_t len = strlen(bind->command);
free(ipc_single_command(bar->ipc_socketfd,
@@ -500,7 +500,7 @@ static bool handle_barconfig_update(struct swaybar *bar,
const char *new_state = json_object_get_string(json_state);
char *old_state = config->hidden_state;
if (strcmp(new_state, old_state) != 0) {
- wlr_log(WLR_DEBUG, "Changing bar hidden state to %s", new_state);
+ sway_log(SWAY_DEBUG, "Changing bar hidden state to %s", new_state);
free(old_state);
config->hidden_state = strdup(new_state);
return determine_bar_visibility(bar, false);
@@ -510,7 +510,7 @@ static bool handle_barconfig_update(struct swaybar *bar,
json_object *json_mode;
json_object_object_get_ex(json_config, "mode", &json_mode);
config->mode = strdup(json_object_get_string(json_mode));
- wlr_log(WLR_DEBUG, "Changing bar mode to %s", config->mode);
+ sway_log(SWAY_DEBUG, "Changing bar mode to %s", config->mode);
json_object *gaps;
json_object_object_get_ex(json_config, "gaps", &gaps);
@@ -544,7 +544,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
json_object *result = json_tokener_parse(resp->payload);
if (!result) {
- wlr_log(WLR_ERROR, "failed to parse payload as json");
+ sway_log(SWAY_ERROR, "failed to parse payload as json");
free_ipc_response(resp);
return false;
}
@@ -561,7 +561,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
free(bar->mode);
bar->mode = strcmp(change, "default") != 0 ? strdup(change) : NULL;
} else {
- wlr_log(WLR_ERROR, "failed to parse response");
+ sway_log(SWAY_ERROR, "failed to parse response");
bar_is_dirty = false;
break;
}
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 @@
#include <string.h>
#include <stdbool.h>
#include <getopt.h>
-#include <wlr/util/log.h>
#include "swaybar/bar.h"
#include "ipc-client.h"
+#include "log.h"
static struct swaybar swaybar;
@@ -74,13 +74,13 @@ int main(int argc, char **argv) {
}
if (debug) {
- wlr_log_init(WLR_DEBUG, NULL);
+ sway_log_init(SWAY_DEBUG, NULL);
} else {
- wlr_log_init(WLR_INFO, NULL);
+ sway_log_init(SWAY_INFO, NULL);
}
if (!swaybar.id) {
- wlr_log(WLR_ERROR, "No bar_id passed. "
+ sway_log(SWAY_ERROR, "No bar_id passed. "
"Provide --bar_id or let sway start swaybar");
return 1;
}
@@ -88,7 +88,7 @@ int main(int argc, char **argv) {
if (!socket_path) {
socket_path = get_socketpath();
if (!socket_path) {
- wlr_log(WLR_ERROR, "Unable to retrieve socket path");
+ sway_log(SWAY_ERROR, "Unable to retrieve socket path");
return 1;
}
}
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 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
-#include <wlr/util/log.h>
#include "cairo.h"
#include "pango.h"
#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 @@
#include <string.h>
#include <stdio.h>
#include <unistd.h>
-#include <wlr/util/log.h>
+#include "log.h"
#include "loop.h"
#include "swaybar/bar.h"
#include "swaybar/config.h"
@@ -38,7 +38,7 @@ bool status_handle_readable(struct status_line *status) {
errno = 0;
int available_bytes;
if (ioctl(status->read_fd, FIONREAD, &available_bytes) == -1) {
- wlr_log(WLR_ERROR, "Unable to read status command output size");
+ sway_log(SWAY_ERROR, "Unable to read status command output size");
status_error(status, "[error reading from status command]");
return true;
}
@@ -49,7 +49,7 @@ bool status_handle_readable(struct status_line *status) {
status->buffer = realloc(status->buffer, status->buffer_size);
}
if (status->buffer == NULL) {
- wlr_log_errno(WLR_ERROR, "Unable to read status line");
+ sway_log_errno(SWAY_ERROR, "Unable to read status line");
status_error(status, "[error reading from status command]");
return true;
}
@@ -68,13 +68,13 @@ bool status_handle_readable(struct status_line *status) {
&& (header = json_tokener_parse(status->buffer))
&& json_object_object_get_ex(header, "version", &version)
&& json_object_get_int(version) == 1) {
- wlr_log(WLR_DEBUG, "Using i3bar protocol.");
+ sway_log(SWAY_DEBUG, "Using i3bar protocol.");
status->protocol = PROTOCOL_I3BAR;
json_object *click_events;
if (json_object_object_get_ex(header, "click_events", &click_events)
&& json_object_get_boolean(click_events)) {
- wlr_log(WLR_DEBUG, "Enabling click events.");
+ sway_log(SWAY_DEBUG, "Enabling click events.");
status->click_events = true;
if (write(status->write_fd, "[\n", 2) != 2) {
status_error(status, "[failed to write to status command]");
@@ -86,11 +86,11 @@ bool status_handle_readable(struct status_line *status) {
json_object *signal;
if (json_object_object_get_ex(header, "stop_signal", &signal)) {
status->stop_signal = json_object_get_int(signal);
- wlr_log(WLR_DEBUG, "Setting stop signal to %d", status->stop_signal);
+ sway_log(SWAY_DEBUG, "Setting stop signal to %d", status->stop_signal);
}
if (json_object_object_get_ex(header, "cont_signal", &signal)) {
status->cont_signal = json_object_get_int(signal);
- wlr_log(WLR_DEBUG, "Setting cont signal to %d", status->cont_signal);
+ sway_log(SWAY_DEBUG, "Setting cont signal to %d", status->cont_signal);
}
json_object_put(header);
@@ -102,7 +102,7 @@ bool status_handle_readable(struct status_line *status) {
return i3bar_handle_readable(status);
}
- wlr_log(WLR_DEBUG, "Using text protocol.");
+ sway_log(SWAY_DEBUG, "Using text protocol.");
status->protocol = PROTOCOL_TEXT;
status->text = status->buffer;
// intentional fall-through
@@ -140,7 +140,7 @@ struct status_line *status_line_init(char *cmd) {
int pipe_read_fd[2];
int pipe_write_fd[2];
if (pipe(pipe_read_fd) != 0 || pipe(pipe_write_fd) != 0) {
- wlr_log(WLR_ERROR, "Unable to create pipes for status_command fork");
+ sway_log(SWAY_ERROR, "Unable to create pipes for status_command fork");
exit(1);
}
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) {
static void add_sni(struct swaybar_tray *tray, char *id) {
int idx = list_seq_find(tray->items, cmp_sni_id, id);
if (idx == -1) {
- wlr_log(WLR_INFO, "Registering Status Notifier Item '%s'", id);
+ sway_log(SWAY_INFO, "Registering Status Notifier Item '%s'", id);
struct swaybar_sni *sni = create_sni(id, tray);
if (sni) {
list_add(tray->items, sni);
@@ -34,7 +34,7 @@ static int handle_sni_registered(sd_bus_message *msg, void *data,
char *id;
int ret = sd_bus_message_read(msg, "s", &id);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
}
struct swaybar_tray *tray = data;
@@ -48,13 +48,13 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
char *id;
int ret = sd_bus_message_read(msg, "s", &id);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret));
}
struct swaybar_tray *tray = data;
int idx = list_seq_find(tray->items, cmp_sni_id, id);
if (idx != -1) {
- wlr_log(WLR_INFO, "Unregistering Status Notifier Item '%s'", id);
+ sway_log(SWAY_INFO, "Unregistering Status Notifier Item '%s'", id);
destroy_sni(tray->items->items[idx]);
list_del(tray->items, idx);
set_bar_dirty(tray->bar);
@@ -66,20 +66,20 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data,
sd_bus_error *error) {
if (sd_bus_message_is_method_error(msg, NULL)) {
sd_bus_error err = *sd_bus_message_get_error(msg);
- wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", err.message);
+ sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message);
return -sd_bus_error_get_errno(&err);
}
int ret = sd_bus_message_enter_container(msg, 'v', NULL);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
return ret;
}
char **ids;
ret = sd_bus_message_read_strv(msg, &ids);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
return ret;
}
@@ -99,7 +99,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
host->watcher_interface, watcher_path, host->watcher_interface,
"RegisterStatusNotifierHost", NULL, NULL, "s", host->service);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to send register call: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to send register call: %s", strerror(-ret));
return false;
}
@@ -109,7 +109,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
get_registered_snis_callback, host->tray, "ss",
host->watcher_interface, "RegisteredStatusNotifierItems");
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", strerror(-ret));
}
return ret >= 0;
@@ -120,7 +120,7 @@ static int handle_new_watcher(sd_bus_message *msg,
char *service, *old_owner, *new_owner;
int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
return ret;
}
@@ -148,7 +148,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
watcher_path, host->watcher_interface,
"StatusNotifierItemRegistered", handle_sni_registered, tray);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to registering events: %s",
+ sway_log(SWAY_ERROR, "Failed to subscribe to registering events: %s",
strerror(-ret));
goto error;
}
@@ -156,7 +156,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
watcher_path, host->watcher_interface,
"StatusNotifierItemUnregistered", handle_sni_unregistered, tray);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s",
+ sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
strerror(-ret));
goto error;
}
@@ -165,7 +165,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
"/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged",
handle_new_watcher, host);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s",
+ sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
strerror(-ret));
goto error;
}
@@ -180,7 +180,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid);
ret = sd_bus_request_name(tray->bus, host->service, 0);
if (ret < 0) {
- wlr_log(WLR_DEBUG, "Failed to acquire service name: %s", strerror(-ret));
+ sway_log(SWAY_DEBUG, "Failed to acquire service name: %s", strerror(-ret));
goto error;
}
@@ -193,7 +193,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
sd_bus_slot_set_floating(unreg_slot, 1);
sd_bus_slot_set_floating(watcher_slot, 1);
- wlr_log(WLR_DEBUG, "Registered %s", host->service);
+ sway_log(SWAY_DEBUG, "Registered %s", host->service);
return true;
error:
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) {
list_add(theme_names, theme->name);
}
char *theme_list = join_list(theme_names, ", ");
- wlr_log(WLR_DEBUG, "Loaded themes: %s", theme_list);
+ sway_log(SWAY_DEBUG, "Loaded themes: %s", theme_list);
free(theme_list);
list_free(theme_names);
}
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,
const char *prop, list_t **dest) {
int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)");
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
return ret;
}
if (sd_bus_message_at_end(msg, 0)) {
- wlr_log(WLR_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop);
+ sway_log(SWAY_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop);
return ret;
}
@@ -52,14 +52,14 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
while (!sd_bus_message_at_end(msg, 0)) {
ret = sd_bus_message_enter_container(msg, 'r', "iiay");
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
goto error;
}
int size;
ret = sd_bus_message_read(msg, "ii", NULL, &size);
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
goto error;
}
@@ -67,7 +67,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
size_t npixels;
ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels);
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
goto error;
}
@@ -81,7 +81,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
}
list_free_items_and_destroy(*dest);
*dest = pixmaps;
- wlr_log(WLR_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop,
+ sway_log(SWAY_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop,
pixmaps->length);
return ret;
@@ -107,7 +107,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
int ret;
if (sd_bus_message_is_method_error(msg, NULL)) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop,
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop,
sd_bus_message_get_error(msg)->message);
ret = sd_bus_message_get_errno(msg);
goto cleanup;
@@ -115,7 +115,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
ret = sd_bus_message_enter_container(msg, 'v', type);
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
goto cleanup;
}
@@ -131,16 +131,16 @@ static int get_property_callback(sd_bus_message *msg, void *data,
ret = sd_bus_message_read(msg, type, dest);
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
goto cleanup;
}
if (*type == 's' || *type == 'o') {
char **str = dest;
*str = strdup(*str);
- wlr_log(WLR_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str);
+ sway_log(SWAY_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str);
} else if (*type == 'b') {
- wlr_log(WLR_DEBUG, "%s %s = %s", sni->watcher_id, prop,
+ sway_log(SWAY_DEBUG, "%s %s = %s", sni->watcher_id, prop,
*(bool *)dest ? "true" : "false");
}
}
@@ -165,7 +165,7 @@ static void sni_get_property_async(struct swaybar_sni *sni, const char *prop,
sni->path, "org.freedesktop.DBus.Properties", "Get",
get_property_callback, data, "ss", sni->interface, prop);
if (ret < 0) {
- wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
}
}
@@ -188,10 +188,10 @@ static int sni_check_msg_sender(struct swaybar_sni *sni, sd_bus_message *msg,
bool has_well_known_names =
sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES;
if (sni->service[0] == ':' || has_well_known_names) {
- wlr_log(WLR_DEBUG, "%s has new %s", sni->watcher_id, signal);
+ sway_log(SWAY_DEBUG, "%s has new %s", sni->watcher_id, signal);
return 1;
} else {
- wlr_log(WLR_DEBUG, "%s may have new %s", sni->watcher_id, signal);
+ sway_log(SWAY_DEBUG, "%s may have new %s", sni->watcher_id, signal);
return 0;
}
}
@@ -218,12 +218,12 @@ static int handle_new_status(sd_bus_message *msg, void *data, sd_bus_error *erro
char *status;
int r = sd_bus_message_read(msg, "s", &status);
if (r < 0) {
- wlr_log(WLR_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret));
+ sway_log(SWAY_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret));
ret = r;
} else {
free(sni->status);
sni->status = strdup(status);
- wlr_log(WLR_DEBUG, "%s has new status = '%s'", sni->watcher_id, status);
+ sway_log(SWAY_DEBUG, "%s has new status = '%s'", sni->watcher_id, status);
set_sni_dirty(sni);
}
} else {
@@ -238,7 +238,7 @@ static void sni_match_signal(struct swaybar_sni *sni, sd_bus_slot **slot,
int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path,
sni->interface, signal, callback, sni);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to signal %s: %s", signal,
+ sway_log(SWAY_ERROR, "Failed to subscribe to signal %s: %s", signal,
strerror(-ret));
}
}
@@ -353,7 +353,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
static enum hotspot_event_handling icon_hotspot_callback(
struct swaybar_output *output, struct swaybar_hotspot *hotspot,
int x, int y, uint32_t button, void *data) {
- wlr_log(WLR_DEBUG, "Clicked on %s", (char *)data);
+ sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data);
struct swaybar_tray *tray = output->bar->tray;
int idx = list_seq_find(tray->items, cmp_sni_id, data);
@@ -367,11 +367,11 @@ static enum hotspot_event_handling icon_hotspot_callback(
int global_y = output->output_y + (top_bar ? config->gaps.top + y:
(int) output->output_height - config->gaps.bottom - y);
- wlr_log(WLR_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
+ sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event
return HOTSPOT_IGNORE;
} else {
- wlr_log(WLR_DEBUG, "but it doesn't exist");
+ sway_log(SWAY_DEBUG, "but it doesn't exist");
}
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,
char *service, *old_owner, *new_owner;
int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
return ret;
}
@@ -34,12 +34,12 @@ static int handle_lost_watcher(sd_bus_message *msg,
}
struct swaybar_tray *create_tray(struct swaybar *bar) {
- wlr_log(WLR_DEBUG, "Initializing tray");
+ sway_log(SWAY_DEBUG, "Initializing tray");
sd_bus *bus;
int ret = sd_bus_open_user(&bus);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
return NULL;
}
@@ -58,7 +58,7 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
"/org/freedesktop/DBus", "org.freedesktop.DBus",
"NameOwnerChanged", handle_lost_watcher, tray);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s",
+ sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
strerror(-ret));
}
@@ -96,7 +96,7 @@ void tray_in(int fd, short mask, void *data) {
// This space intentionally left blank
}
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to process bus: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to process bus: %s", strerror(-ret));
}
}
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,
char *service, *old_owner, *new_owner;
int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
return ret;
}
@@ -37,7 +37,7 @@ static int handle_lost_service(sd_bus_message *msg,
using_standard_protocol(watcher) ? cmp_id : cmp_service, service);
if (idx != -1) {
char *id = watcher->items->items[idx];
- wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id);
+ sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id);
list_del(watcher->items, idx);
sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
"StatusNotifierItemUnregistered", "s", id);
@@ -46,7 +46,7 @@ static int handle_lost_service(sd_bus_message *msg,
idx = list_seq_find(watcher->hosts, cmp_id, service);
if (idx != -1) {
- wlr_log(WLR_DEBUG, "Unregistering Status Notifier Host '%s'", service);
+ sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service);
free(watcher->hosts->items[idx]);
list_del(watcher->hosts, idx);
}
@@ -59,7 +59,7 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
char *service_or_path, *id;
int ret = sd_bus_message_read(msg, "s", &service_or_path);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
return ret;
}
@@ -81,12 +81,12 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
}
if (list_seq_find(watcher->items, cmp_id, id) == -1) {
- wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id);
+ sway_log(SWAY_DEBUG, "Registering Status Notifier Item '%s'", id);
list_add(watcher->items, id);
sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
"StatusNotifierItemRegistered", "s", id);
} else {
- wlr_log(WLR_DEBUG, "Status Notifier Item '%s' already registered", id);
+ sway_log(SWAY_DEBUG, "Status Notifier Item '%s' already registered", id);
free(id);
}
@@ -97,18 +97,18 @@ static int register_host(sd_bus_message *msg, void *data, sd_bus_error *error) {
char *service;
int ret = sd_bus_message_read(msg, "s", &service);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to parse register host message: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to parse register host message: %s", strerror(-ret));
return ret;
}
struct swaybar_watcher *watcher = data;
if (list_seq_find(watcher->hosts, cmp_id, service) == -1) {
- wlr_log(WLR_DEBUG, "Registering Status Notifier Host '%s'", service);
+ sway_log(SWAY_DEBUG, "Registering Status Notifier Host '%s'", service);
list_add(watcher->hosts, strdup(service));
sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
"StatusNotifierHostRegistered", "s", service);
} else {
- wlr_log(WLR_DEBUG, "Status Notifier Host '%s' already registered", service);
+ sway_log(SWAY_DEBUG, "Status Notifier Host '%s' already registered", service);
}
return sd_bus_reply_method_return(msg, "");
@@ -166,7 +166,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path,
watcher->interface, watcher_vtable, watcher);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to add object vtable: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to add object vtable: %s", strerror(-ret));
goto error;
}
@@ -174,14 +174,14 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
"/org/freedesktop/DBus", "org.freedesktop.DBus",
"NameOwnerChanged", handle_lost_service, watcher);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s",
+ sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
strerror(-ret));
goto error;
}
ret = sd_bus_request_name(bus, watcher->interface, 0);
if (ret < 0) {
- wlr_log(WLR_ERROR, "Failed to acquire service name: %s", strerror(-ret));
+ sway_log(SWAY_ERROR, "Failed to acquire service name: %s", strerror(-ret));
goto error;
}
@@ -192,7 +192,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
watcher->hosts = create_list();
watcher->items = create_list();
watcher->version = 0;
- wlr_log(WLR_DEBUG, "Registered %s", watcher->interface);
+ sway_log(SWAY_DEBUG, "Registered %s", watcher->interface);
return watcher;
error:
sd_bus_slot_unref(signal_slot);