## Main

Main — Program startup.

## Synopsis

    GOptionContext *    meta_get_option_context             (void);
    void                meta_init                           (void);
    int                 meta_run                            (void);
    gboolean            meta_get_replace_current_wm         (void);
    void                meta_set_wm_name                    (const char *wm_name);
    void                meta_set_gnome_wm_keybindings       (const char *wm_keybindings);
    enum                MetaExitCode;
    void                meta_exit                           (MetaExitCode code);
    void                meta_quit                           (MetaExitCode code);

## Description

Functions which parse the command-line arguments, create the display, kick everything off and then close down Mutter when it's time to go.

Mutter - a boring window manager for the adult in you

Many window managers are like Marshmallow Froot Loops; Mutter is like Frosted Flakes: it's still plain old corn, but dusted with some sugar.

The best way to get a handle on how the whole system fits together is discussed in doc/code-overview.txt; if you're looking for functions to investigate, read `main()`, `meta_display_open()`, and `event_callback()`.

## Details

### meta_get_option_context ()

    GOptionContext *    meta_get_option_context             (void);

Returns a GOptionContext initialized with mutter-related options. Parse the command-line args with this before calling `meta_init()`.

Returns : | the GOptionContext

### meta_init ()

    void                meta_init                           (void);

Initialize mutter. Call this after `meta_get_option_context()` and `meta_plugin_manager_set_plugin_type()`, and before `meta_run()`.

### meta_run ()

    int                 meta_run                            (void);

Runs mutter. Call this after completing initialization that doesn't require an event loop.

Returns : | mutter's exit status

### meta_get_replace_current_wm ()

    gboolean            meta_get_replace_current_wm         (void);

### meta_set_wm_name ()

    void                meta_set_wm_name                    (const char *wm_name);

Set the value to use for the _NET_WM_NAME property. To take effect, it is necessary to call this function before `meta_init()`.

`wm_name` : | value for _NET_WM_NAME

### meta_set_gnome_wm_keybindings ()

    void                meta_set_gnome_wm_keybindings       (const char *wm_keybindings);

Set the value to use for the _GNOME_WM_KEYBINDINGS property. To take effect, it is necessary to call this function before `meta_init()`.

`wm_keybindings` : | value for _GNOME_WM_KEYBINDINGS

### enum MetaExitCode

    typedef enum {
      META_EXIT_SUCCESS,
      META_EXIT_ERROR
    } MetaExitCode;

`META_EXIT_SUCCESS` | Success
`META_EXIT_ERROR` | Error

### meta_exit ()

    void                meta_exit                           (MetaExitCode code);

### meta_quit ()

    void                meta_quit                           (MetaExitCode code);

Stops Mutter. This tells the event loop to stop processing; it is rather dangerous to use this because this will leave the user with no window manager. We generally do this only if, for example, the session manager asks us to; we assume the session manager knows what it's talking about.

`code` : | The success or failure code to return to the calling process.