C++
C++
Drive a real tmux from C++.
libtmux-cxx
Install
$ vcpkg install libtmux-cxxQuickstart
// No tmux failure is thrown. Every call answers with a value that is either// the result or the reason there isn't one.const auto sessions = server.sessions();if (!sessions.has_value()) { std::fprintf(stderr, "%s\n", sessions.error().diagnostic.c_str()); return 1;}
for (const libtmux::Session& session : *sessions) { std::printf("%s has %lld window(s)\n", std::string{session.name()}.c_str(), session.window_count());}server in the code above comes from Server::from_env() (inside tmux), Server::at_socket_name() , Server::at_socket_path() , or Server::at_default() — the README's own words for how to get one.
The README's Quickstart, "Connect and look around" — lives in examples/05-readme.cpp, and tools/docs/check_readme.py fails the build if the two ever disagree.
API References
Read on
Topics
Deep dives into one subject at a time, in C++: architecture, traversal, options and hooks.
Guides
Task-oriented walkthroughs in C++ — install tmux, then the round trip every real program starts from.
Examples
The same concrete tasks worked through in C++, with each snippet checked by the port's own tests.
Concepts
The domain model every port shares — the object hierarchy, transports and filtering.