ChafaTermDb: Chafa Reference Manual

## ChafaTermDb ChafaTermDb — A database of terminal information |

## Functions

ChafaTermDb * | chafa_term_db_new ()
ChafaTermDb * | chafa_term_db_copy ()
void | chafa_term_db_ref ()
void | chafa_term_db_unref ()
ChafaTermDb * | chafa_term_db_get_default ()
ChafaTermInfo * | chafa_term_db_detect ()
ChafaTermInfo * | chafa_term_db_get_fallback_info ()

## Types and Values

typedef | ChafaTermDb

## Description

A ChafaTermDb contains information on terminals, and can be used to obtain a suitable ChafaTermInfo for a terminal environment.

## Functions

### chafa_term_db_new ()

    ChafaTermDb *
    chafa_term_db_new (void);

Creates a new, blank ChafaTermDb.

#### Returns

The new ChafaTermDb

Since: 1.6

### chafa_term_db_copy ()

    ChafaTermDb *
    chafa_term_db_copy (const ChafaTermDb *term_db);

Creates a new ChafaTermDb that's a copy of `term_db` .

#### Parameters

term_db | A ChafaTermDb to copy. |

#### Returns

The new ChafaTermDb

Since: 1.6

### chafa_term_db_ref ()

    void
    chafa_term_db_ref (ChafaTermDb *term_db);

Adds a reference to `term_db` .

#### Parameters

term_db | ChafaTermDb to add a reference to. |

Since: 1.6

### chafa_term_db_unref ()

    void
    chafa_term_db_unref (ChafaTermDb *term_db);

Removes a reference from `term_db` .

#### Parameters

term_db | ChafaTermDb to remove a reference from. |

Since: 1.6

### chafa_term_db_get_default ()

    ChafaTermDb *
    chafa_term_db_get_default (void);

Gets the global ChafaTermDb. This can normally be used safely in a read-only capacity. The caller should not unref the returned object.

#### Returns

The global ChafaTermDb

Since: 1.6

### chafa_term_db_detect ()

    ChafaTermInfo *
    chafa_term_db_detect (ChafaTermDb *term_db,
                          gchar **envp);

Builds a new ChafaTermInfo with capabilities implied by the provided environment variables (principally the TERM variable, but also others).

`envp` can be gotten from `g_get_environ()`.

#### Parameters

term_db | A ChafaTermDb. |
envp | A strv of environment variables. |

#### Returns

A new ChafaTermInfo.

Since: 1.6

### chafa_term_db_get_fallback_info ()

    ChafaTermInfo *
    chafa_term_db_get_fallback_info (ChafaTermDb *term_db);

Builds a new ChafaTermInfo with fallback control sequences. This can be used with unknown but presumably modern terminals, or to supplement missing capabilities in a detected terminal.

Fallback control sequences may cause unpredictable behavior and should only be used as a last resort.

#### Parameters

term_db | A ChafaTermDb. |

#### Returns

A new ChafaTermInfo.

Since: 1.6

## Types and Values

### ChafaTermDb

    typedef struct ChafaTermDb ChafaTermDb;