tmux

package
v0.0.0-...-e537141 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd(l *slog.Logger) *Z.Cmd

Types

type CommandImpl

type CommandImpl struct {
	// contains filtered or unexported fields
}

func (CommandImpl) HasSession

func (c CommandImpl) HasSession(id ID) (bool, error)

func (CommandImpl) JoinSession

func (c CommandImpl) JoinSession(id ID) error

FIXME: this is not working

func (CommandImpl) NewSession

func (c CommandImpl) NewSession(id ID, cfg SessionConfig) error

type Config

type Config struct {
	Sessions map[string]SessionConfig `json:"sessions"`
}

type FlagsAsConfig

type FlagsAsConfig struct {
	// tmux flag: -f
	ConfigFile *string `json:"config_file" toml:"config_file"`
	Socket     Socket  `json:"socket" toml:"socket"`
	// tmux flag: -u
	TryUseUtf8 bool `json:"try_use_utf8" toml:"try_use_utf8"`
	// tmux flag: -v
	VerboseLogging bool `json:"verbose_logging" toml:"verbose_logging"`
}

FlagsAsConfig allows to specify tmux flags in a structured way.

func (FlagsAsConfig) MarshalFlags

func (f FlagsAsConfig) MarshalFlags(into *flags.ErrMut) (err error)

type FlagsAsString

type FlagsAsString struct {
	Flags []string `json:"flags" toml:"flags"`
}

FlagsAsString allows to specify flags passed to tmux as a string.

type ID

type ID struct {
	String string
	Mode   IDMode
}

func AsID

func AsID(id int) (s ID)

func AsName

func AsName(name string) (s ID)

type IDMode

type IDMode int

ENUM(

Index
Name

)

const (
	// IDModeIndex is a IDMode of type Index.
	IDModeIndex IDMode = iota
	// IDModeName is a IDMode of type Name.
	IDModeName
)

func ParseIDMode

func ParseIDMode(name string) (IDMode, error)

ParseIDMode attempts to convert a string to a IDMode.

func (IDMode) MarshalText

func (x IDMode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (IDMode) String

func (x IDMode) String() string

String implements the Stringer interface.

func (*IDMode) UnmarshalText

func (x *IDMode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type SessionConfig

type SessionConfig struct {
	Directory    *string  `json:"directory"`
	SelectWindow *int     `json:"select_window"`
	Windows      []Window `json:"windows"`
}

SessionConfig defines the layout of a tmux session

type Size

type Size struct {
	Num  float64 `json:"num"`
	Unit Unit    `json:"unit"`
}

type Socket

type Socket struct {
	// tmux flag: -L
	Name *string `json:"name" toml:"name"`
	// tmux flag: -S
	Path *string `json:"path" toml:"path"`
}

func (Socket) MarshalFlags

func (s Socket) MarshalFlags(into *flags.ErrMut) (err error)

type Tmux

type Tmux interface {
	NewSession(id ID, cfg SessionConfig) error
	HasSession(id ID) (bool, error)
	JoinSession(id ID) error
}

type Unit

type Unit int
const (
	UnitPercent Unit = iota
	UnitCells
)

type Window

type Window struct {
	Commands []string   `json:"commands"`
	Size     Size       `json:"size"`
	Mode     WindowMode `json:"mode"`
	Name     *string    `json:"name"`
}

type WindowMode

type WindowMode int
const (
	WindowHorizontal WindowMode = iota
	WindowVertical
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL