{"id":13894384,"url":"https://github.com/polybar/i3ipcpp","last_synced_at":"2025-07-17T09:32:16.466Z","repository":{"id":52574949,"uuid":"58294531","full_name":"polybar/i3ipcpp","owner":"polybar","description":"C++ interface to i3 ipc","archived":false,"fork":true,"pushed_at":"2023-11-27T14:50:40.000Z","size":305,"stargazers_count":8,"open_issues_count":1,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T05:07:39.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"drmgc/i3ipcpp","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polybar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-05-08T03:18:09.000Z","updated_at":"2023-04-12T20:37:13.000Z","dependencies_parsed_at":"2023-02-04T16:31:36.255Z","dependency_job_id":null,"html_url":"https://github.com/polybar/i3ipcpp","commit_stats":{"total_commits":78,"total_committers":11,"mean_commits":7.090909090909091,"dds":0.4487179487179487,"last_synced_commit":"b361f1e074e21f7b43e57f7545c3e2d1ca3e1658"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polybar%2Fi3ipcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polybar%2Fi3ipcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polybar%2Fi3ipcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polybar%2Fi3ipcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polybar","download_url":"https://codeload.github.com/polybar/i3ipcpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225995910,"owners_count":17557035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:01:31.252Z","updated_at":"2024-11-24T23:30:37.560Z","avatar_url":"https://github.com/polybar.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)\n\ni3ipc++\n=======\nAn implementation of i3 IPC in C++11.\n\n## Requirements\n\n* cmake (\u003e= 3.0)\n* C++11 compiler\n* sigc++ 2.0\n* jsoncpp\n\n## Using\nYet the only way of using is to add this repo as a submodule\n\n```bash\ngit submodule add https://github.com/drmgc/i3ipcpp.git ./i3ipc++/\n```\n\nThen just type this in your `CMakeLists.txt`:\n\n```cmake\n...\nadd_subdirectory(i3ipc++)\n\ninclude_directories(${I3IPCpp_INCLUDE_DIRS})\nlink_directories(${I3IPCpp_LIBRARY_DIRS})\n...\n```\n\nAnd then just link:\n\n```cmake\n...\ntarget_link_libraries(someapp ${I3IPCpp_LIBRARIES})\n...\n```\n\n## Usage\n\nSee also examples in `examples/` directory.\n\n### Connecting\n\n```c++\n#include \u003ci3ipc++/ipc.hpp\u003e\n\ni3ipc::connection  conn;\n```\n\nThe connection will be established automaticly.\n\n### Event handling\n\nFirst of all you need to declare the events you want to handle. As example we want to handle an binding and workspace events:\n```c++\nconn.subscribe(i3ipc::ET_WORKSPACE | i3ipc::ET_BINDING);\n```\n\nThen we need to connect to the signal handlers:\n```c++\n// Handler of WORKSPACE EVENT\nconn.signal_workspace_event.connect([](const i3ipc::workspace_event_t\u0026  ev) {\n\tstd::cout \u003c\u003c \"workspace_event: \" \u003c\u003c (char)ev.type \u003c\u003c std::endl;\n\tif (ev.current) {\n\t\tstd::cout \u003c\u003c \"\\tSwitched to #\" \u003c\u003c ev.current-\u003enum \u003c\u003c \" - \\\"\" \u003c\u003c ev.current-\u003ename \u003c\u003c '\"' \u003c\u003c std::endl;\n\t}\n});\n\n// Handler of binding event\nconn.signal_binding_event.connect([](const i3ipc::binding_t\u0026  b) {\n\tstd::cout \u003c\u003c \"binding_event:\" \u003c\u003c std::endl\n\t\t\u003c\u003c \"\\tcommand = \\\"\" \u003c\u003c b.command \u003c\u003c '\"' \u003c\u003c std::endl\n\t\t\u003c\u003c \"\\tinput_code = \" \u003c\u003c b.input_code \u003c\u003c std::endl\n\t\t\u003c\u003c \"\\tsymbol = \" \u003c\u003c b.symbol \u003c\u003c std::endl\n\t\t\u003c\u003c \"\\tinput_type = \" \u003c\u003c static_cast\u003cchar\u003e(b.input_type) \u003c\u003c std::endl\n\t\t\u003c\u003c \"\\tevent_state_mask =\" \u003c\u003c std::endl;\n\tfor (const std::string\u0026 s : b.event_state_mask) {\n\t\tstd::cout \u003c\u003c \"\\t\\t\\\"\" \u003c\u003c s \u003c\u003c '\"' \u003c\u003c std::endl;\n\t}\n});\n```\n\nThen we starting the event-handling loop\n```c++\nwhile (true) {\n\tconn.handle_event();\n}\n```\n\n**Note:** If you want to interract with event_socket or just want to prepare manually you can call `conn.connect_event_socket()` (if you want to reconnect `conn.connect_event_socket(true)`), but if by default `connect_event_socket()` called on first `handle_event()` call.\n\n### Requesting\n\nAlso you can request some data from i3, as example barconfigs:\n```c++\nstd::vector\u003cstd::string\u003e  bar_configs = conn.get_bar_configs_list();\n```\n\nAnd then do with them something:\n```c++\nfor (auto\u0026  name : bar_configs) {\n\tstd::shared_ptr\u003ci3ipc::bar_config_t\u003e  bc = conn.get_bar_config(name);\n\n\t// ... handling\n}\n```\n\n### Sending commands\n\nAnd, of course, you can command i3:\n```c++\nif (!conn.send_command(\"exit\")) {\n\tthrow std::string(\"Failed to exit via command\");\n}\n```\n\n## Version i3 support\nIt is written according to the *current* specification, so some of new features in IPC can be not-implemented. If there is some of them, please notice at issues page.\n\n## Documentation\nThe latest documentation you can find [**here**](http://drmgc.github.io/docs/api-ref/i3ipc++/latest/)\n\n## Licensing\nThis library is licensed under under the MIT license, but it also uses [`JsonCpp`](https://github.com/open-source-parsers/jsoncpp) (*only for parsing i3's replies*) and my header-only library [`auss`](https://github.com/drmgc/auss)\n\n## Backward compatibility note\nWhile version is `0.x` there can be a lack of backward compatibility between minor releases, please see release notes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolybar%2Fi3ipcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolybar%2Fi3ipcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolybar%2Fi3ipcpp/lists"}