# terminal/ghostty (zidane-ui/terminal)

Import: `import { … } from 'zidane-ui/terminal'`. Source: [ui/src/terminal/ghostty.ts](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/ghostty.ts).

## Functions

### `loadGhostty`

Function.

The initialised library. A failed load is forgotten, so the next view retries.

```ts
function loadGhostty(symbolsFontUrl?: string): Promise<__module>
```

**Parameters**

- `symbolsFontUrl?` (`string`): Where the app serves the [`SYMBOLS_FONT`](https://zidane.si/docs/reference/ui-terminal-ghostty.md#SYMBOLS_FONT) face, loaded before
  the first terminal so the canvas has it on paint. Without it those glyphs draw as boxes.

**Returns** `Promise<__module>`

Source: [ui/src/terminal/ghostty.ts:106](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/ghostty.ts#L106)

### `openTerminal`

Function.

`term.open(mount)` without its focus grab: ghostty-web's `open` calls `focus()`, which
focuses the terminal now and again on a timer, so one mounting in the background (the drawer
of a conversation a space switch reopened) took focus from wherever the user was. `focus` is
a no-op while `open` runs; the surfaces focus the terminal themselves when asked to
(`autoFocus`).

```ts
function openTerminal(
  term: { focus(): void; open(parent: HTMLElement): void },
  mount: HTMLElement,
): void
```

**Parameters**

- `term` (`{ focus(): void; open(parent: HTMLElement): void }`): The terminal to open.
- `mount` (`HTMLElement`): The element it renders into.

Source: [ui/src/terminal/ghostty.ts:69](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/ghostty.ts#L69)

## Constants

### `SYMBOLS_FONT`

Constant.

Nerd Font symbols (powerline arrows, the git branch glyph prompts print,
file icons): the family the app puts last in its terminal font stack, so
a Nerd Font the user has installed still wins.

```ts
const SYMBOLS_FONT = 'Symbols Nerd Font Mono'
```

Source: [ui/src/terminal/ghostty.ts:88](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/ghostty.ts#L88)
