ibusshare: IBus Reference Manual

## ibusshare ibusshare — Shared utility functions and definition. |

## Stability Level

Stable, unless otherwise indicated

## Functions

const gchar * | ibus_get_local_machine_id ()
void | ibus_set_display ()
const gchar * | ibus_get_address ()
void | ibus_write_address ()
const gchar * | ibus_get_user_name ()
glong | ibus_get_daemon_uid ()
const gchar * | ibus_get_socket_path ()
gint | ibus_get_timeout ()
void | ibus_free_strv ()
gchar * | ibus_key_event_to_string ()
gboolean | ibus_key_event_from_string ()
void | ibus_init ()
void | ibus_main ()
void | ibus_quit ()
void | ibus_set_log_handler ()
void | ibus_unset_log_handler ()

## Types and Values

#define | IBUS_DEPRECATED
#define | IBUS_SERVICE_IBUS
#define | IBUS_SERVICE_PORTAL
#define | IBUS_SERVICE_PANEL
#define | IBUS_SERVICE_PANEL_EXTENSION
#define | IBUS_SERVICE_PANEL_EXTENSION_EMOJI
#define | IBUS_SERVICE_CONFIG
#define | IBUS_SERVICE_NOTIFICATIONS
#define | IBUS_PATH_IBUS
#define | IBUS_PATH_FACTORY
#define | IBUS_PATH_PANEL
#define | IBUS_PATH_PANEL_EXTENSION_EMOJI
#define | IBUS_PATH_CONFIG
#define | IBUS_PATH_NOTIFICATIONS
#define | IBUS_PATH_INPUT_CONTEXT
#define | IBUS_INTERFACE_IBUS
#define | IBUS_INTERFACE_PORTAL
#define | IBUS_INTERFACE_INPUT_CONTEXT
#define | IBUS_INTERFACE_FACTORY
#define | IBUS_INTERFACE_ENGINE
#define | IBUS_INTERFACE_PANEL
#define | IBUS_INTERFACE_CONFIG
#define | IBUS_INTERFACE_NOTIFICATIONS

## Description

This file defines some utility functions and definition which are shared among ibus component and services.

## Functions

### ibus_get_local_machine_id ()

    const gchar *
    ibus_get_local_machine_id (void);

Obtains the machine UUID of the machine this process is running on.

#### Returns

A newly allocated string that shows the UUID of the machine.

### ibus_set_display ()

    void
    ibus_set_display (const gchar *display);

Set the display address.

#### Parameters

display | Display address, as in DISPLAY environment for X. |

### ibus_get_address ()

    const gchar *
    ibus_get_address (void);

Return the D-Bus address of IBus. It will find the address from following source:

1. Environment variable IBUS_ADDRESS

2. Socket file under ~/.config/ibus/bus/

#### Returns

D-Bus address of IBus. `NULL` for not found.

See also: `ibus_write_address()`.

### ibus_write_address ()

    void
    ibus_write_address (const gchar *address);

Write D-Bus address to socket file.

See also: `ibus_get_address()`.

#### Parameters

address | D-Bus address of IBus. |

### ibus_get_user_name ()

    const gchar *
    ibus_get_user_name (void);

Get the current user name. It is determined by:

1. `getlogin()`

2. Environment variable SUDO_USER

3. Environment variable USERHELPER_UID

4. Environment variable USERNAME

5. Environment variable LOGNAME

6. Environment variable USER

7. Environment variable LNAME

#### Returns

A newly allocated string that stores current user name.

### ibus_get_daemon_uid ()

    glong
    ibus_get_daemon_uid (void);

`ibus_get_daemon_uid` is deprecated and should not be used in newly-written code.

This function has been deprecated and should not be used in newly written code.

Get UID of ibus-daemon.

#### Returns

UID of ibus-daemon; or 0 if UID is not available.

### ibus_get_socket_path ()

    const gchar *
    ibus_get_socket_path (void);

Get the path of socket file.

#### Returns

A newly allocated string that stores the path of socket file.

### ibus_get_timeout ()

    gint
    ibus_get_timeout (void);

Get the GDBus timeout in milliseconds. The timeout is for clients (e.g. im-ibus.so), not for ibus-daemon. Note that the timeout for ibus-daemon could be set by --timeout command line option of the daemon.

#### Returns

A GDBus timeout in milliseconds. -1 when default timeout for GDBus should be used.

### ibus_free_strv ()

    void
    ibus_free_strv (gchar **strv);

`ibus_free_strv` is deprecated and should not be used in newly-written code.

This function has been deprecated and should not be used in newly written code.

Free a list of strings.

#### Parameters

strv | List of strings. |

### ibus_key_event_to_string ()

    gchar *
    ibus_key_event_to_string (guint keyval,
                              guint modifiers);

Return the name of a key symbol and modifiers.

For example, if press ctrl, shift, and enter, then this function returns: Shift+Control+enter.

#### Parameters

keyval | Key symbol. |
modifiers | Modifiers such as Ctrl or Shift. |

#### Returns

The name of a key symbol and modifier.

### ibus_key_event_from_string ()

    gboolean
    ibus_key_event_from_string (const gchar *string,
                                guint *keyval,
                                guint *modifiers);

Parse key event string and return key symbol and modifiers.

#### Parameters

string | Key event string. |
keyval | Variable that hold key symbol result. | [out]
modifiers | Variable that hold modifiers result. | [out]

#### Returns

`TRUE` for succeed; `FALSE` if failed.

### ibus_init ()

    void
    ibus_init (void);

Initialize the ibus types.

### ibus_main ()

    void
    ibus_main (void);

Runs an IBus main loop until `ibus_quit()` is called in the loop.

See also: `ibus_quit()`.

### ibus_quit ()

    void
    ibus_quit (void);

Stops an IBus from running.

Any calls to `ibus_quit()` for the loop will return. See also: `ibus_main()`.

### ibus_set_log_handler ()

    void
    ibus_set_log_handler (gboolean verbose);

Sets GLIB's log handler to ours. Our log handler adds time info including hour, minute, second, and microsecond, like:

(ibus-daemon:7088): IBUS-DEBUG: 18:06:45.822819: ibus-daemon started

If `verbose` is `TRUE`, all levels of messages will be logged. Otherwise, DEBUG and WARNING messages will be ignored. The function is used in ibus-daemon, but can be useful for IBus client programs as well for debugging. It's totally fine for not calling this function. If you don't set a custom GLIB log handler, the default GLIB log handler will be used.

#### Parameters

verbose | TRUE for verbose logging. |

### ibus_unset_log_handler ()

    void
    ibus_unset_log_handler (void);

Remove the log handler which is set by ibus_set_log_handler.

## Types and Values

### IBUS_DEPRECATED

    #define IBUS_DEPRECATED

### IBUS_SERVICE_IBUS

    #define IBUS_SERVICE_IBUS       "org.freedesktop.IBus"

Address of IBus service.

### IBUS_SERVICE_PORTAL

    #define IBUS_SERVICE_PORTAL     "org.freedesktop.portal.IBus"

Address of IBus portalservice.

### IBUS_SERVICE_PANEL

    #define IBUS_SERVICE_PANEL      "org.freedesktop.IBus.Panel"

Address of IBus panel service.

### IBUS_SERVICE_PANEL_EXTENSION

    #define IBUS_SERVICE_PANEL_EXTENSION "org.freedesktop.IBus.Panel.Extension"

Address of IBus panel extension service.

### IBUS_SERVICE_PANEL_EXTENSION_EMOJI

    #define             IBUS_SERVICE_PANEL_EXTENSION_EMOJI

Address of IBus panel extension service for emoji. This service provides emoji, Unicode code point, Unicode name features.

### IBUS_SERVICE_CONFIG

    #define IBUS_SERVICE_CONFIG     "org.freedesktop.IBus.Config"

Address of IBus config service.

### IBUS_SERVICE_NOTIFICATIONS

    #define IBUS_SERVICE_NOTIFICATIONS    "org.freedesktop.IBus.Notifications"

Address of IBus notification service.

### IBUS_PATH_IBUS

    #define IBUS_PATH_IBUS          "/org/freedesktop/IBus"

D-Bus path for IBus

### IBUS_PATH_FACTORY

    #define IBUS_PATH_FACTORY       "/org/freedesktop/IBus/Factory"

D-Bus path for IBus factory.

### IBUS_PATH_PANEL

    #define IBUS_PATH_PANEL         "/org/freedesktop/IBus/Panel"

D-Bus path for IBus panel.

### IBUS_PATH_PANEL_EXTENSION_EMOJI

    #define             IBUS_PATH_PANEL_EXTENSION_EMOJI

D-Bus path for IBus extension panel for emoji. This service provides emoji, Unicode code point, Unicode name features.

### IBUS_PATH_CONFIG

    #define IBUS_PATH_CONFIG        "/org/freedesktop/IBus/Config"

D-Bus path for IBus config.

### IBUS_PATH_NOTIFICATIONS

    #define IBUS_PATH_NOTIFICATIONS "/org/freedesktop/IBus/Notifications"

D-Bus path for IBus notifications.

### IBUS_PATH_INPUT_CONTEXT

    #define IBUS_PATH_INPUT_CONTEXT "/org/freedesktop/IBus/InputContext_%d"

Template of D-Bus path for IBus input context.

### IBUS_INTERFACE_IBUS

    #define IBUS_INTERFACE_IBUS     "org.freedesktop.IBus"

D-Bus interface for IBus.

### IBUS_INTERFACE_PORTAL

    #define IBUS_INTERFACE_PORTAL   "org.freedesktop.IBus.Portal"

D-Bus interface for IBus portal.

### IBUS_INTERFACE_INPUT_CONTEXT

    #define             IBUS_INTERFACE_INPUT_CONTEXT

D-Bus interface for IBus input context.

### IBUS_INTERFACE_FACTORY

    #define IBUS_INTERFACE_FACTORY  "org.freedesktop.IBus.Factory"

D-Bus interface for IBus factory.

### IBUS_INTERFACE_ENGINE

    #define IBUS_INTERFACE_ENGINE   "org.freedesktop.IBus.Engine"

D-Bus interface for IBus engine.

### IBUS_INTERFACE_PANEL

    #define IBUS_INTERFACE_PANEL    "org.freedesktop.IBus.Panel"

D-Bus interface for IBus panel.

### IBUS_INTERFACE_CONFIG

    #define IBUS_INTERFACE_CONFIG   "org.freedesktop.IBus.Config"

D-Bus interface for IBus config.

### IBUS_INTERFACE_NOTIFICATIONS

    #define IBUS_INTERFACE_NOTIFICATIONS    "org.freedesktop.IBus.Notifications"

D-Bus interface for IBus notifications.