diff --git a/lib/i3ipcpp b/lib/i3ipcpp index 85b444c0..b361f1e0 160000 --- a/lib/i3ipcpp +++ b/lib/i3ipcpp @@ -1 +1 @@ -Subproject commit 85b444c06267fbae8e9e06877cae6f03b42acbfb +Subproject commit b361f1e074e21f7b43e57f7545c3e2d1ca3e1658 diff --git a/src/modules/i3.cpp b/src/modules/i3.cpp index 15185477..f8b26f39 100644 --- a/src/modules/i3.cpp +++ b/src/modules/i3.cpp @@ -7,6 +7,8 @@ #include "modules/meta/base.inl" #include "utils/file.hpp" +#include + POLYBAR_NS namespace modules { @@ -18,10 +20,15 @@ namespace modules { m_router->register_action(EVENT_NEXT, [this]() { action_next(); }); m_router->register_action(EVENT_PREV, [this]() { action_prev(); }); - auto socket_path = i3ipc::get_socketpath(); - - if (!file_util::exists(socket_path)) { - throw module_error("Could not find socket: " + (socket_path.empty() ? "" : socket_path)); + try { + auto socket_path = i3ipc::get_socketpath(); + if (!file_util::exists(socket_path)) { + throw module_error("i3 socket does not exist: " + (socket_path.empty() ? "" : socket_path)); + } else { + m_log.info("%s: Found i3 socket at '%s'", name(), socket_path); + } + } catch (const i3ipc::ipc_error& e) { + throw module_error("Could not find i3 socket: " + string(e.what())); } m_ipc = std::make_unique();