Raxol.Terminal.Tab.UnifiedTab (Raxol v0.5.0)

View Source

Provides unified tab management functionality for the terminal emulator. This module handles tab creation, switching, state management, and configuration.

Summary

Functions

Returns a specification to start this module under a supervisor.

Cleans up resources.

Closes a tab and its associated windows.

Creates a new tab with the given configuration.

Gets the active tab ID.

Gets the state of a specific tab.

Gets the list of all tabs.

Moves a tab to a new position.

Sets the active tab.

Starts the tab manager with the given options.

Updates the tab manager configuration.

Updates the configuration of a specific tab.

Types

tab_config()

@type tab_config() :: %{
  optional(:name) => String.t(),
  optional(:icon) => String.t(),
  optional(:color) => String.t(),
  optional(:position) => non_neg_integer(),
  optional(:state) => tab_state()
}

tab_id()

@type tab_id() :: non_neg_integer()

tab_state()

@type tab_state() :: :active | :inactive | :hidden

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup()

@spec cleanup() :: :ok

Cleans up resources.

close_tab(tab_id)

@spec close_tab(tab_id()) :: :ok | {:error, term()}

Closes a tab and its associated windows.

create_tab(config \\ %{})

@spec create_tab(map()) :: {:ok, tab_id()} | {:error, term()}

Creates a new tab with the given configuration.

get_active_tab()

@spec get_active_tab() :: {:ok, tab_id()} | {:error, :no_active_tab}

Gets the active tab ID.

get_tab_state(tab_id)

@spec get_tab_state(tab_id()) :: {:ok, map()} | {:error, term()}

Gets the state of a specific tab.

get_tabs()

@spec get_tabs() :: [tab_id()]

Gets the list of all tabs.

move_tab(tab_id, position)

@spec move_tab(tab_id(), non_neg_integer()) :: :ok | {:error, term()}

Moves a tab to a new position.

set_active_tab(tab_id)

@spec set_active_tab(tab_id()) :: :ok | {:error, term()}

Sets the active tab.

start_link(opts \\ %{})

@spec start_link(map()) :: GenServer.on_start()

Starts the tab manager with the given options.

update_config(config)

@spec update_config(map()) :: :ok

Updates the tab manager configuration.

update_tab_config(tab_id, config)

@spec update_tab_config(tab_id(), tab_config()) :: :ok | {:error, term()}

Updates the configuration of a specific tab.