Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-ts latest

Server.hasSession

Whether a session with this name exists.

Source and package
Qualified name
Server.hasSession
Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts
Other languages
PowerShell Julia Elixir Python Ruby Lua RustGoJavaC# C++ Swift Kotlin Scala F#

Description#

The name is matched exactly, including one holding "." or ":". tmux normally accepts a unique prefix as a session target, which would make checking work answer yes for workspace; this method does not, and it lists every session and compares in JavaScript rather than asking tmux to resolve a target, since no target spelling is both exact and correct for a name holding a target separator. No server running on the socket answers false; any other failure to list sessions raises rather than being read as "no such session".

Examples#

if (!(await server.hasSession("work"))) {
await server.newSession({ name: "work" });
}
Parameters

tmux command#

The tmux commands behind hasSession.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

Whether a session with this name exists

Equivalents of Whether a session with this name exists in other languages
Language Equivalent
Python libtmux.Server.has_session
Rust server.Server.has_session
Go tmux.Server.HasSession
Java io.github.libtmux.Server.hasSession
C# LibTmux.Server.HasSessionAsync
C++ no equivalent on Server
Swift Server.hasSession(_:)

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference