LibTmux.Extensions.DependencyInjection
0.1.2
Prefix Reserved
dotnet add package LibTmux.Extensions.DependencyInjection --version 0.1.2
NuGet\Install-Package LibTmux.Extensions.DependencyInjection -Version 0.1.2
<PackageReference Include="LibTmux.Extensions.DependencyInjection" Version="0.1.2" />
<PackageVersion Include="LibTmux.Extensions.DependencyInjection" Version="0.1.2" />
<PackageReference Include="LibTmux.Extensions.DependencyInjection" />
paket add LibTmux.Extensions.DependencyInjection --version 0.1.2
#r "nuget: LibTmux.Extensions.DependencyInjection, 0.1.2"
#:package LibTmux.Extensions.DependencyInjection@0.1.2
#addin nuget:?package=LibTmux.Extensions.DependencyInjection&version=0.1.2
#tool nuget:?package=LibTmux.Extensions.DependencyInjection&version=0.1.2
LibTmux.Extensions.DependencyInjection
Registers LibTmux with
Microsoft.Extensions.DependencyInjection, so an application that already
composes its services can take a tmux server handle as a dependency.
Add it to your project:
$ dotnet add package LibTmux.Extensions.DependencyInjection
Quick start
Register the server, then take it as a constructor parameter:
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddLibTmux(options => options with { SocketName = "build" });
Server is then injectable:
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using LibTmux;
public sealed class Builder(Server server)
{
public Task<IReadOnlyList<Session>> SessionsAsync(CancellationToken cancellationToken) =>
server.GetSessionsAsync(cancellationToken);
}
The next block points the registration at a socket and resolves the handle. It
uses server and ct from a tmux server of its own, and it throws if the
resolved handle reaches no sessions:
using LibTmux;
using Microsoft.Extensions.DependencyInjection;
ServiceCollection services = new();
services.AddLibTmux(options => options with { SocketName = server.ConnectionOptions.SocketName });
await using ServiceProvider provider = services.BuildServiceProvider();
Server injected = provider.GetRequiredService<Server>();
IReadOnlyList<Session> sessions = await injected.GetSessionsAsync(ct);
if (sessions.Count == 0)
{
throw new InvalidOperationException("The injected Server reached no sessions.");
}
What AddLibTmux registers
Serveris a singleton. Handles are immutable and safe to share across threads.AddLibTmuxopens a server without connecting: nothing runs tmux until a call needs it, and a tmux that restarts is picked up by the next call.- Nothing serializes tmux itself. One server applies commands in the order it receives them.
Bind options from configuration
ServerConnectionOptions is registered through
IOptions<T>, so it binds from configuration. This example also references
Microsoft.Extensions.Configuration and
Microsoft.Extensions.Options.ConfigurationExtensions:
using LibTmux;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
var configuration = new Microsoft.Extensions.Configuration.ConfigurationBuilder().Build();
configuration["LibTmux:SocketName"] = "build";
services.Configure<ServerConnectionOptions>(configuration.GetSection("LibTmux"));
services.AddLibTmux();
The options are immutable, so the callback receives a copy and returns one. It runs after binding, so it has the last word:
using System;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddLibTmux(options => options with { CommandTimeout = TimeSpan.FromSeconds(5) });
When the options name no logger and the provider has an ILoggerFactory, one
is taken from it, so tmux commands are logged with everything else.
What it leaves out
- Scoped or transient lifetimes.
Serveris registered as a singleton. - Hosting. It registers services and starts nothing in the background.
Support and status
- Pre-1.0. Any release may change or remove an exported identifier. The changelog marks each break, so pin an exact version.
- Dependencies. LibTmux and the
Microsoft.Extensions.DependencyInjectionabstractions. - tmux and .NET. The tmux versions LibTmux supports, on net8.0 and net10.0.
- Systems. Linux, including WSL. macOS is best effort.
Documentation
Server: the handle this registers- Source:
src/LibTmux.Extensions.DependencyInjection; issues and history on GitHub - Package: NuGet
- Changelog: what each release of this package changed
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- LibTmux (>= 0.1.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Options (>= 10.0.15)
-
net8.0
- LibTmux (>= 0.1.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.2 | 105 | 11/29/2026 |
| 0.1.1 | 123 | 11/1/2026 |
| 0.1.0 | 135 | 10/25/2026 |
| 0.0.0-alpha.24 | 73 | 10/25/2026 |
| 0.0.0-alpha.23 | 114 | 10/24/2026 |
| 0.0.0-alpha.22 | 77 | 10/19/2026 |
| 0.0.0-alpha.21 | 76 | 10/11/2026 |
| 0.0.0-alpha.20 | 79 | 10/5/2026 |
| 0.0.0-alpha.19 | 74 | 10/4/2026 |
| 0.0.0-alpha.18 | 82 | 10/3/2026 |
| 0.0.0-alpha.17 | 100 | 9/27/2026 |
| 0.0.0-alpha.16 | 73 | 9/26/2026 |
| 0.0.0-alpha.15 | 85 | 9/20/2026 |
| 0.0.0-alpha.14 | 78 | 9/20/2026 |
All eight LibTmux packages share version 0.1.2. LibTmux guards raw layout commands on older tmux servers, and LibTmux.Mcp ships the MCP SDK 2.4.0. Pin exact package versions while the public API is evolving. Read the LibTmux.Extensions.DependencyInjection changelog at https://github.com/libtmux/libtmux-dotnet/blob/master/src/LibTmux.Extensions.DependencyInjection/CHANGELOG.md and the release summary at https://github.com/libtmux/libtmux-dotnet/blob/v0.1.2/CHANGELOG.md