From c650513b67b013aa9dd204a4df65ec5b4f11e88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20BOULMIER?= Date: Tue, 4 Jun 2019 17:34:16 -0400 Subject: [PATCH] fix(i3): Surround ws names with quotes (#1798) Fixes #1797 --- include/modules/i3.hpp | 4 +++- src/modules/i3.cpp | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/modules/i3.hpp b/include/modules/i3.hpp index 873c91b4..95a5c131 100644 --- a/include/modules/i3.hpp +++ b/include/modules/i3.hpp @@ -56,6 +56,8 @@ namespace modules { bool input(string&& cmd); private: + static string make_workspace_command(const string& workspace); + static constexpr const char* DEFAULT_TAGS{" "}; static constexpr const char* DEFAULT_MODE{"default"}; static constexpr const char* DEFAULT_WS_ICON{"ws-icon-default"}; @@ -92,6 +94,6 @@ namespace modules { unique_ptr m_ipc; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/src/modules/i3.cpp b/src/modules/i3.cpp index 5df0106a..b01cf5c8 100644 --- a/src/modules/i3.cpp +++ b/src/modules/i3.cpp @@ -231,7 +231,7 @@ namespace modules { if (cmd.compare(0, strlen(EVENT_CLICK), EVENT_CLICK) == 0) { cmd.erase(0, strlen(EVENT_CLICK)); m_log.info("%s: Sending workspace focus command to ipc handler", name()); - conn.send_command("workspace " + cmd); + conn.send_command(make_workspace_command(cmd)); return true; } @@ -257,14 +257,14 @@ namespace modules { if (scrolldir == "next" && (m_wrap || next(current_ws) != workspaces.end())) { if (!(*current_ws)->focused) { m_log.info("%s: Sending workspace focus command to ipc handler", name()); - conn.send_command("workspace " + (*current_ws)->name); + conn.send_command(make_workspace_command((*current_ws)->name)); } m_log.info("%s: Sending workspace next_on_output command to ipc handler", name()); conn.send_command("workspace next_on_output"); } else if (scrolldir == "prev" && (m_wrap || current_ws != workspaces.begin())) { if (!(*current_ws)->focused) { m_log.info("%s: Sending workspace focus command to ipc handler", name()); - conn.send_command("workspace " + (*current_ws)->name); + conn.send_command(make_workspace_command((*current_ws)->name)); } m_log.info("%s: Sending workspace prev_on_output command to ipc handler", name()); conn.send_command("workspace prev_on_output"); @@ -276,6 +276,10 @@ namespace modules { return true; } -} + + string i3_module::make_workspace_command(const string& workspace) { + return "workspace \"" + workspace + "\""; + } +} // namespace modules POLYBAR_NS_END