Raxol.Terminal.Tab.TabServer (Raxol v2.0.1)

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.

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.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

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(init_opts \\ [])

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.