General: GNT Reference Manual

## General General — General API for managing GNT |

## Functions

#define | GNTSEAL()
void | gnt_init ()
void | gnt_main ()
gboolean | gnt_ascii_only ()
void | gnt_window_present ()
void | gnt_screen_occupy ()
void | gnt_screen_release ()
void | gnt_screen_update ()
void | gnt_screen_resize_widget ()
void | gnt_screen_move_widget ()
void | gnt_screen_rename_widget ()
gboolean | gnt_widget_has_focus ()
void | gnt_widget_set_urgent ()
void | gnt_register_action ()
gboolean | gnt_screen_menu_show ()
void | gnt_quit ()
GntClipboard * | gnt_get_clipboard ()
gchar * | gnt_get_clipboard_string ()
void | gnt_set_clipboard_string ()
gboolean | gnt_giveup_console ()
gboolean | gnt_is_refugee ()

## Description

## Functions

### GNTSEAL()

    #define             GNTSEAL(ident)

### gnt_init ()

    void
    gnt_init (void);

Initialize GNT.

### gnt_main ()

    void
    gnt_main (void);

Start running the mainloop for gnt.

### gnt_ascii_only ()

    gboolean
    gnt_ascii_only (void);

Check whether the terminal is capable of UTF8 display.

#### Returns

`FALSE` if the terminal is capable of drawing UTF-8, `TRUE` otherwise.

### gnt_window_present ()

    void
    gnt_window_present (GntWidget *window);

Present a window. If the event was triggered because of user interaction, the window is moved to the foreground. Otherwise, the Urgent hint is set.

#### Parameters

window | The window the present. |

Since: 2.1.0

### gnt_screen_occupy ()

    void
    gnt_screen_occupy (GntWidget *widget);

`gnt_screen_occupy` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Use `gnt_widget_show()` instead.

Internal function -- do not use. Use `gnt_widget_show()` instead.

### gnt_screen_release ()

    void
    gnt_screen_release (GntWidget *widget);

`gnt_screen_release` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Use `gnt_widget_hide()` instead.

Internal function -- do not use. Use `gnt_widget_hide()` instead.

### gnt_screen_update ()

    void
    gnt_screen_update (GntWidget *widget);

`gnt_screen_update` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Use `gnt_widget_draw()` instead.

Internal function -- do not use. Use `gnt_widget_draw()` instead.

### gnt_screen_resize_widget ()

    void
    gnt_screen_resize_widget (GntWidget *widget,
                              int width,
                              int height);

Resize a widget.

#### Parameters

widget | The widget to resize. |
width | The desired width. |
height | The desired height. |

### gnt_screen_move_widget ()

    void
    gnt_screen_move_widget (GntWidget *widget,
                            int x,
                            int y);

Move a widget.

#### Parameters

widget | The widget to move. |
x | The desired x-coordinate. |
y | The desired y-coordinate. |

### gnt_screen_rename_widget ()

    void
    gnt_screen_rename_widget (GntWidget *widget,
                              const char *text);

Rename a widget.

#### Parameters

widget | The widget to rename. |
text | The new name for the widget. |

### gnt_widget_has_focus ()

    gboolean
    gnt_widget_has_focus (GntWidget *widget);

Check whether a widget has focus.

#### Parameters

widget | The widget. |

#### Returns

`TRUE` if the widget has the current focus, `FALSE` otherwise.

### gnt_widget_set_urgent ()

    void
    gnt_widget_set_urgent (GntWidget *widget);

Set the URGENT hint for a widget.

#### Parameters

widget | The widget to set the URGENT hint for. |

### gnt_register_action ()

    void
    gnt_register_action (const char *label,
                         void (*callback) (void));

Register a global action.

#### Parameters

label | The user-visible label for the action. |
callback | The callback function for the action. |

### gnt_screen_menu_show ()

    gboolean
    gnt_screen_menu_show (gpointer menu);

Show a menu.

#### Parameters

menu | The menu to display. |

#### Returns

`TRUE` if the menu is displayed, `FALSE` otherwise (e.g., if another menu is currently displayed).

### gnt_quit ()

    void
    gnt_quit (void);

Terminate the mainloop of gnt.

### gnt_get_clipboard ()

    GntClipboard *
    gnt_get_clipboard (void);

Get the global clipboard.

#### Returns

The clipboard.

[transfer none]

### gnt_get_clipboard_string ()

    gchar *
    gnt_get_clipboard_string (void);

Get the string in the clipboard.

#### Returns

A copy of the string in the clipboard. The caller must `g_free()` the string.

### gnt_set_clipboard_string ()

    void
    gnt_set_clipboard_string (const gchar *string);

Set the contents of the global clipboard.

#### Parameters

string | The new content of the new clipboard. |

### gnt_giveup_console ()

    gboolean
    gnt_giveup_console (const char *wd,
                        char **argv,
                        char **envp,
                        gint *stin,
                        gint *stout,
                        gint *sterr,
                        void (*callback) (int status, gpointer data),
                        gpointer data);

Spawn a different application that will consume the console.

#### Parameters

wd | The working directory for the new application. |
argv | The argument vector. |
envp | The environment, or `NULL`. |
stin | Location to store the child's stdin, or `NULL`. |
stout | Location to store the child's stdout, or `NULL`. |
sterr | Location to store the child's stderr, or `NULL`. |
callback | The callback to call after the child exits. |
data | The data to pass to the callback. |

#### Returns

`TRUE` if the child was successfully spawned, `FALSE` otherwise.

### gnt_is_refugee ()

    gboolean
    gnt_is_refugee (void);

Check whether a child process is in control of the current terminal.

#### Returns

`TRUE` if a child process (eg., PAGER) is occupying the current terminal, `FALSE` otherwise.