Raxol.Terminal.Window.UnifiedWindow (Raxol v0.5.0)

View Source

Unified window management system for the Raxol Terminal Emulator. Handles window creation, manipulation, state management, and ANSI sequence processing.

Summary

Functions

Returns a specification to start this module under a supervisor.

Cleans up the window manager.

Closes a window and its children.

Creates a new window with the given options.

Gets the active window ID.

Gets the state of a window.

Moves a window to the specified position.

Resizes a window to the specified dimensions.

Sets the active window.

Sets the window icon name.

Maximizes or restores a window.

Sets the window's stacking order.

Sets the window title.

Splits an existing window in the specified direction.

Starts the window manager with optional configuration.

Updates the window manager configuration.

Types

t()

@type t() :: %Raxol.Terminal.Window.UnifiedWindow{
  active_window: window_id() | nil,
  config: map(),
  next_id: non_neg_integer(),
  windows: %{required(window_id()) => window_state()}
}

window_id()

@type window_id() :: String.t()

window_state()

@type window_state() :: %{
  id: window_id(),
  title: String.t(),
  icon_name: String.t(),
  size: {non_neg_integer(), non_neg_integer()},
  position: {non_neg_integer(), non_neg_integer()},
  stacking_order: :normal | :above | :below,
  iconified: boolean(),
  maximized: boolean(),
  previous_size: {non_neg_integer(), non_neg_integer()} | nil,
  split_type: :none | :horizontal | :vertical,
  parent_id: window_id() | nil,
  children: [window_id()],
  buffer_id: String.t(),
  renderer_id: String.t()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup(window_manager)

Cleans up the window manager.

close_window(window_id)

@spec close_window(window_id()) :: :ok | {:error, String.t()}

Closes a window and its children.

create_window(opts \\ %{})

@spec create_window(map()) :: {:ok, window_id()} | {:error, String.t()}

Creates a new window with the given options.

get_active_window()

@spec get_active_window() :: window_id() | nil

Gets the active window ID.

get_window_state(window_id)

@spec get_window_state(window_id()) :: {:ok, window_state()} | {:error, String.t()}

Gets the state of a window.

move(window_id, x, y)

@spec move(window_id(), non_neg_integer(), non_neg_integer()) ::
  :ok | {:error, String.t()}

Moves a window to the specified position.

resize(window_id, width, height)

@spec resize(window_id(), non_neg_integer(), non_neg_integer()) ::
  :ok | {:error, String.t()}

Resizes a window to the specified dimensions.

set_active_window(window_id)

@spec set_active_window(window_id()) :: :ok | {:error, String.t()}

Sets the active window.

set_icon_name(window_id, name)

@spec set_icon_name(window_id(), String.t()) :: :ok | {:error, String.t()}

Sets the window icon name.

set_maximized(window_id, maximized)

@spec set_maximized(window_id(), boolean()) :: :ok | {:error, String.t()}

Maximizes or restores a window.

set_stacking_order(window_id, order)

@spec set_stacking_order(window_id(), :normal | :above | :below) ::
  :ok | {:error, String.t()}

Sets the window's stacking order.

set_title(window_id, title)

@spec set_title(window_id(), String.t()) :: :ok | {:error, String.t()}

Sets the window title.

split_window(window_id, direction)

@spec split_window(window_id(), :horizontal | :vertical) ::
  {:ok, window_id()} | {:error, String.t()}

Splits an existing window in the specified direction.

start_link(opts \\ %{})

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

Starts the window manager with optional configuration.

update_config(config)

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

Updates the window manager configuration.