Raxol.Terminal.Configuration (Raxol v0.2.0)

View Source

Manages the core Raxol terminal configuration struct.

This module defines the main configuration structure and provides functions for creating and updating configuration based on defaults and user-provided options.

It collaborates with other modules under Raxol.Terminal.Config.* for specific functionalities like defaults, profiles, capabilities detection, and applying settings to the running terminal.

Summary

Functions

Creates a new configuration struct, merging defaults with provided options.

Updates an existing configuration struct with new values from a keyword list.

Types

animation_type()

@type animation_type() :: :gif | :video | :shader | :particle

background_type()

@type background_type() :: :solid | :transparent | :image | :animated

color_mode()

@type color_mode() :: :basic | :true_color | :palette

t()

@type t() :: %Raxol.Terminal.Configuration{
  accessibility_mode: boolean(),
  background_blur: float(),
  background_image: String.t() | nil,
  background_opacity: float(),
  background_scale: :fit | :fill | :stretch,
  background_type: background_type(),
  batch_size: integer(),
  bracketed_paste: boolean(),
  cleanup_interval: non_neg_integer(),
  command_history_size: non_neg_integer(),
  cursor_blink: boolean(),
  cursor_color: String.t(),
  cursor_style: :block | :underline | :bar,
  enable_command_history: boolean(),
  enable_fullscreen: boolean(),
  enable_syntax_highlighting: boolean(),
  focus_support: boolean(),
  font_family: String.t(),
  font_rendering: :normal | :subpixel | :grayscale,
  font_size: integer(),
  height: non_neg_integer(),
  hyperlinks: boolean(),
  image_support: boolean(),
  ligatures: boolean(),
  line_height: float(),
  memory_limit: non_neg_integer(),
  mouse_support: boolean(),
  prompt: String.t(),
  scrollback_height: non_neg_integer(),
  selection_color: String.t(),
  sixel_support: boolean(),
  sound_support: boolean(),
  theme: theme_map(),
  title_support: boolean(),
  unicode_support: boolean(),
  virtual_scroll: boolean(),
  welcome_message: String.t(),
  width: non_neg_integer()
}

terminal_type()

@type terminal_type() ::
  :iterm2
  | :windows_terminal
  | :xterm
  | :screen
  | :kitty
  | :alacritty
  | :konsole
  | :gnome_terminal
  | :vscode
  | :unknown

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new configuration struct, merging defaults with provided options.

Fetches the base default configuration map and then merges any overrides provided in opts. The final result is converted into the %__MODULE__{} struct.

update(config, opts)

@spec update(
  t(),
  keyword()
) :: t()

Updates an existing configuration struct with new values from a keyword list.