i3ipc++
An C++ implementaiton of the i3 IPC
 All Classes Functions Variables Enumerations Enumerator Modules
i3ipc::connection Class Reference

Connection to the i3. More...

#include <ipc.hpp>

Public Member Functions

 connection (const std::string &socket_path=get_socketpath())
 Connect to the i3. More...
 
bool send_command (const std::string &command) const
 Send a command to i3. More...
 
std::vector< std::shared_ptr
< workspace_t > > 
get_workspaces () const
 Request a list of workspaces. More...
 
std::vector< std::shared_ptr
< output_t > > 
get_outputs () const
 Request a list of outputs. More...
 
version_t get_version () const
 Request a version of i3. More...
 
std::shared_ptr< container_tget_tree () const
 Request a tree of windows. More...
 
std::vector< std::string > get_bar_configs_list () const
 Request a list of names of available barconfigs. More...
 
std::shared_ptr< bar_config_tget_bar_config (const std::string &name) const
 Request a barconfig. More...
 
bool subscribe (const int32_t events)
 Subscribe on an events of i3. More...
 
void handle_event ()
 Handle an event from i3. More...
 
int32_t get_main_socket_fd ()
 Get the fd of the main socket. More...
 
int32_t get_event_socket_fd ()
 Get the fd of the event socket. More...
 

Public Attributes

sigc::signal< void, const
workspace_event_t & > 
signal_workspace_event
 Workspace event signal.
 
sigc::signal< void > signal_output_event
 Output event signal.
 
sigc::signal< void > signal_mode_event
 Output mode event signal.
 
sigc::signal< void, const
window_event_t & > 
signal_window_event
 Window event signal.
 
sigc::signal< void, const
bar_config_t & > 
signal_barconfig_update_event
 Barconfig update event signal.
 
sigc::signal< void, const
binding_t & > 
signal_binding_event
 Binding event signal.
 
sigc::signal< void, EventType,
const std::shared_ptr< const
buf_t > & > 
signal_event
 i3 event signal More...
 

Protected Member Functions

void prepare_to_event_handling ()
 

Detailed Description

Connection to the i3.

Constructor & Destructor Documentation

i3ipc::connection::connection ( const std::string &  socket_path = get_socketpath())

Connect to the i3.

Parameters
socket_pathpath to a i3 IPC socket

Member Function Documentation

std::shared_ptr<bar_config_t> i3ipc::connection::get_bar_config ( const std::string &  name) const

Request a barconfig.

Parameters
namename of barconfig
Returns
The barconfig
std::vector<std::string> i3ipc::connection::get_bar_configs_list ( ) const

Request a list of names of available barconfigs.

Returns
A list of names of barconfigs
int32_t i3ipc::connection::get_event_socket_fd ( )

Get the fd of the event socket.

Returns
the file descriptor of the event socket.
int32_t i3ipc::connection::get_main_socket_fd ( )

Get the fd of the main socket.

Returns
the file descriptor of the main socket.
std::vector< std::shared_ptr<output_t> > i3ipc::connection::get_outputs ( ) const

Request a list of outputs.

Returns
List of outputs
std::shared_ptr<container_t> i3ipc::connection::get_tree ( ) const

Request a tree of windows.

Returns
A root container
version_t i3ipc::connection::get_version ( ) const

Request a version of i3.

Returns
Version of i3
std::vector< std::shared_ptr<workspace_t> > i3ipc::connection::get_workspaces ( ) const

Request a list of workspaces.

Returns
List of workspaces
void i3ipc::connection::handle_event ( )

Handle an event from i3.

Note
Used only in main()
bool i3ipc::connection::send_command ( const std::string &  command) const

Send a command to i3.

Parameters
commandcommand
Returns
Is command successfully executed
bool i3ipc::connection::subscribe ( const int32_t  events)

Subscribe on an events of i3.

If connection isn't handling events at the moment, event numer will be added to subscription list. Else will also send subscripe request to i3

Example:

Parameters
eventsevent type (EventType enum)
Returns
Is successfully subscribed. If connection isn't handling events at the moment, then always true.

Member Data Documentation

sigc::signal<void, EventType, const std::shared_ptr<const buf_t>&> i3ipc::connection::signal_event

i3 event signal

Note
Default handler routes event to signal according to type

The documentation for this class was generated from the following file: