Pane.SplitAsync
Splits this pane.
Source and package
- Qualified name
-
LibTmux .Pane. Split Async - Namespace
- LibTmux
- Declared in
Pane- Package
- LibTmux
- Source
- src/LibTmux/Pane.Topology.cs
- async Task<Pane> SplitAsync( Split
Pane ? request = null, CancellationRequest Token cancellationToken = default ) -
- Parameters
-
-
request(SplitPane ?) – How to split.Request Default
null -
cancellationToken(CancellationToken ) – Cancels the tmux command.Default
default
-
- Returns
-
The created pane.
Examples
Create entities directly inside an owned server scope, then read the session and window children. The outer scope stops its daemon and all created entities. Use Linux or macOS with tmux 3.3a or newer, the .NET 10 SDK or newer, and the .NET 8 and 10 runtimes. In an empty directory, save this project as
Example.csproj. It references the 0.1.1 release ofLibTmuxon NuGet: View sourceExample.csproj <Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFrameworks>net8.0;net10.0</TargetFrameworks><LangVersion>12.0</LangVersion><Nullable>enable</Nullable><ImplicitUsings>disable</ImplicitUsings><EnableDefaultCompileItems>false</EnableDefaultCompileItems><TreatWarningsAsErrors>true</TreatWarningsAsErrors><AnalysisLevel>10-recommended</AnalysisLevel></PropertyGroup><ItemGroup><Compile Include="Program.cs" /><PackageReference Include="LibTmux" Version="[0.1.1]" /></ItemGroup></Project>Save this complete program as
Program.cs. It creates a private server;await usingdisposes its owned scopes after success, cancellation or failure. The complete file contains explicit imports, a top-level async entry point and a cancellation deadline. View sourceProgram.csComplete program using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Threading;using LibTmux;if (OperatingSystem.IsWindows()){throw new PlatformNotSupportedException("This example requires tmux on Linux or macOS.");}using CancellationTokenSource deadline = new(TimeSpan.FromSeconds(10));CancellationToken token = deadline.Token;string? testTmux = Environment.GetEnvironmentVariable("LIBTMUX_TEST_TMUX");string? configured = !string.IsNullOrWhiteSpace(testTmux)? testTmux: Environment.GetEnvironmentVariable("LIBTMUX_TMUX");string binary = string.IsNullOrWhiteSpace(configured) ? "tmux" : configured;using TemporaryDirectory socketRoot = new();ServerConnectionOptions options = new(){SocketPath = Path.Combine(socketRoot.FullName, "tmux.sock"),ConfigurationFile = "/dev/null",TmuxBinaryPath = binary,};// The outer server scope owns everything created directly inside this daemon.await using OwnedServerScope owned = await Server.CreateOwnedAsync(options, token);Session session = await owned.Value.CreateSessionAsync(new NewSessionRequest { Name = "demo", WindowName = "shell", Command = "/bin/cat" }, token);Window window = await session.CreateWindowAsync(new NewWindowRequest { Name = "editor", Command = "/bin/cat" }, token);Pane original = (await window.GetPanesAsync(token)).Single();Pane added = await original.SplitAsync(new SplitPaneRequest { Direction = PaneDirection.Right, Command = "/bin/cat" }, token);IReadOnlyList<Window> windows = await session.GetWindowsAsync(token);IReadOnlyList<Pane> panes = await session.GetPanesAsync(token);if (windows.Count != 2 || panes.Count != 3 || added.Id == original.Id){throw new InvalidOperationException("Expected two windows and three distinct panes.");}Console.WriteLine($"Created session {session.Name} and window {window.Name}.");Console.WriteLine($"Windows: {windows.Count}; panes: {panes.Count}");internal sealed class TemporaryDirectory : IDisposable{private readonly DirectoryInfo _directory = Directory.CreateTempSubdirectory("libtmux-example-");public string FullName => _directory.FullName;public void Dispose() => _directory.Delete(recursive: true);}Build the project and run both supported frameworks. Each program checks its result and exits unsuccessfully after an unhandled error:
Terminal window $ dotnet build Example.csproj --configuration Release && \dotnet bin/Release/net8.0/Example.dll && \dotnet bin/Release/net10.0/Example.dllExpected program output from each framework:
Created session demo and window editor.Windows: 2; panes: 3
Recorded calls
source callsThe C# reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls LibTmux.Pane.SplitAsync.
tmux command
task materialThe tmux commands behind SplitAsync.
tmux C API
task materialThe C declarations in tmux that implement these commands.
Each path starts at a function a command runs, which is degree 1. The degree counts steps from there along the path, and each step is a call or a reference: degree 2 is reached from that function, degree 3 from the next, and so on.
Split a window
- 1
cmd_split_window_exec - references → 2
spawn_pane - calls → 3
window_add_pane - calls → 4
window_pane_create
In other ports
task equivalence 15 other ports mappedSource-verified mappings for Split a pane in two. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.
| Port | API | Differs from C# |
|---|---|---|
| C# | Lib Splits this pane. | This page |
| Python | libtmux Split window and return Pane, by default beneath current pane. | None recorded in the model |
| Ruby | Lib Behavior: Creation. | None recorded in the model |
| Lua | libtmux | None recorded in the model |
| Erlang | tmux Split a pane, or the supplied window's active pane, and observe the new pane. Defaults to a detached vertical split. Options and launch semantics are described in the module docs. Performs I/O; a post-creation read error retains the completed mutation rather than pretending that no pane was created. | free function |
| TypeScript | pane Split this pane and resolve the created pane. | None recorded in the model |
| Rust | pane Split this pane, putting a new one beside it. | None recorded in the model |
| Go | tmux Split creates a tiled pane relative to the receiver's exact linked-pane view. Attach makes the new pane active in that session and winlink; it is not a global client-focus guarantee. The returned Pane is freshly materialized in the receiver SessionID and WindowID. Named Split rather than SplitPane to avoid repeating Pane; Window.SplitPane is the equivalent operation relative to a window. | None recorded in the model |
| Java | io Splits this pane in half, putting the new one below it. | 3 overloads |
| Clojure | libtmux Splits a Pane ref and returns a fresh captured pane occurrence. | free function |
| Kotlin | io Splits this pane in half, putting the new one below it. | 2 overloads |
| Scala | io Splits this pane in half, putting the new one below it. | 3 overloads |
| Swift | Server Splits one pane, returning the pane that appeared. | on Server |
| OCaml | Libtmux Create a detached pane beside the target and return the IDs reported by tmux. Omitted size lets tmux choose the split; tmux rejects splits when no space remains. | free function |
| Perl | Lib split_pane(pane => Pane|pane_id, horizontal => boolean?, command => arrayref?, cwd => bytes?, environment => hashref?). | on Server Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |
| Raku | Lib Create a detached split by default, returning the reported pane ID. | on PaneRef |
No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
no direct pane target; Window.split splits the active pane
No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp or F#.