From d2d90107aa120401f0135c53e9fdc7821aae7ed8 Mon Sep 17 00:00:00 2001 From: notfound4 Date: Mon, 9 May 2016 21:04:12 +0200 Subject: [PATCH] Added a method to get access to the i3 file descriptor --- include/i3ipc++/ipc.hpp | 6 ++++++ src/ipc.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/i3ipc++/ipc.hpp b/include/i3ipc++/ipc.hpp index 198ad99..31e1c31 100644 --- a/include/i3ipc++/ipc.hpp +++ b/include/i3ipc++/ipc.hpp @@ -246,6 +246,12 @@ public: */ void handle_event(); + /** + * Get the file descriptor associated to i3. + * @return the file descriptor associated to i3, -1 if not created yet. + */ + int32_t get_file_descriptor(); + sigc::signal signal_workspace_event; ///< Workspace event signal sigc::signal signal_output_event; ///< Output event signal sigc::signal signal_mode_event; ///< Output mode event signal diff --git a/src/ipc.cpp b/src/ipc.cpp index 687f169..0bd20b6 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -410,4 +410,8 @@ bool connection::send_command(const std::string& command) const { #undef i3IPC_TYPE_STR } +int32_t connection::get_file_descriptor() { + return m_event_socket; +} + }