Xkl.Engine

g GObject.Object GObject.Object Xkl.Engine Xkl.Engine GObject.Object->Xkl.Engine

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

INT__LONG_LONG (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

class

VOID__ENUM_INT_BOOLEAN (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

class

get_instance (display)

allow_one_switch_to_secondary_group ()

backup_names_prop ()

delete_state (win)

filter_events (evt)

get_backend_name ()

get_current_state ()

get_current_window ()

get_current_window_group ()

get_default_group ()

get_features ()

get_groups_names ()

get_indicators_handling ()

get_indicators_names ()

get_max_num_groups ()

get_next_group ()

get_num_groups ()

get_prev_group ()

get_secondary_groups_mask ()

get_state (win, state_out)

get_window_title (win)

grab_key (keycode, modifiers)

is_group_per_toplevel_window ()

is_window_from_same_toplevel_window (win1, win2)

is_window_transparent (win)

lock_group (group)

pause_listen ()

resume_listen ()

save_state (win, state)

set_default_group (group)

set_group_per_toplevel_window (is_global)

set_indicators_handling (whether_handle)

set_secondary_groups_mask (mask)

set_window_transparent (win, transparent)

start_listen (flags)

stop_listen (flags)

ungrab_key (keycode, modifiers)

Virtual Methods

Inherited:

GObject.Object (7)

do_config_notify ()

do_new_device_notify ()

do_new_window_notify (win, parent)

do_state_notify (change_type, group, restore)

Properties

Name

Type

Flags

Short Description

backendName

str

r

Backend name

default-group

int

r

Default group

display

int

r/w/co

X xlib.Display pointer

features

Xkl.EngineFeatures

r

Backend features

indicators-handling

bool

r

Whether engine should handle indicators

max-num-groups

int

r

Max number of groups

num-groups

int

r

Current number of groups

secondary-groups-mask

int

r

Secondary groups mask

Signals

Inherited:

GObject.Object (1)

Name

Short Description

X-config-changed

X-new-device

X-state-changed

new-toplevel-window

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Xkl.Engine(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Xkl.EngineClass

classmethod INT__LONG_LONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:
classmethod VOID__ENUM_INT_BOOLEAN(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:
classmethod get_instance(display)
Parameters:

display (xlib.Display) – the X display used by the application

Returns:

the singleton instance

Return type:

Xkl.Engine

Get the instance of the Xkl.Engine. Within a process, there is always once instance.

allow_one_switch_to_secondary_group()

Allows to switch (once) to the secondary group

backup_names_prop()
Returns:

True on success

Return type:

bool

Backups current XKB configuration into some property - if this property is not defined yet.

delete_state(win)
Parameters:

win (int) – target window

Drops the state of a given window (of its “App window”).

filter_events(evt)
Parameters:

evt (xlib.XEvent) – delivered X event

Returns:

0 if the event it processed - 1 otherwise

Return type:

int

Processes X events. Should be included into the main event cycle of an application. One of the most important functions.

get_backend_name()
Returns:

some string id of the backend

Return type:

str

What kind of backend is used

get_current_state()
Returns:

current state of the keyboard. Returned value is a statically allocated buffer, should not be freed.

Return type:

Xkl.State

get_current_window()
Returns:

currently focused window

Return type:

int

get_current_window_group()
Returns:

saved group id of the current window.

Return type:

int

get_default_group()
Returns:

the default group

Return type:

int

Returns the default group set on window creation If -1, no default group is used

get_features()
Returns:

ORed XKLF_* constants

Return type:

int

Provides information regarding available backend features (combination of XKLF_* constants)

get_groups_names()
Returns:

the array of group names for the current XKB configuration (keyboard). This array is static, should not be freed

Return type:

[str]

get_indicators_handling()
Returns:

the value of the parameter: perform indicator handling

Return type:

bool

get_indicators_names()
Returns:

the array of indicator names for the current XKB configuration (keyboard). This array is static, should not be freed

Return type:

[str]

get_max_num_groups()
Returns:

maximum number of the groups in configuration, 0 if no restrictions.

Return type:

int

Provides the information on maximum number of simultaneously supported groups (layouts)

get_next_group()
Returns:

next group id

Return type:

int

Calculates next group id. Does not change the state of anything.

get_num_groups()
Returns:

the total number of groups in the current configuration (keyboard)

Return type:

int

get_prev_group()
Returns:

prev group id

Return type:

int

Calculates prev group id. Does not change the state of anything.

get_secondary_groups_mask()
Returns:

the secondary group mask

Return type:

int

get_state(win, state_out)
Parameters:
  • win (int) – window to query

  • state_out (Xkl.State) – structure to store the state

Returns:

True on success, otherwise False (the error message can be obtained using xkl_GetLastError).

Return type:

bool

Finds the state for a given window (for its “App window”).

get_window_title(win)
Parameters:

win (int) – X window

Returns:

the window title of some window or None. If not None, it should be freed with XFree

Return type:

str

grab_key(keycode, modifiers)
Parameters:
  • keycode (int) – keycode

  • modifiers (int) – bitmask of modifiers

Returns:

True on success

Return type:

bool

Grabs some key

is_group_per_toplevel_window()
Returns:

the value of the parameter: group per application

Return type:

bool

is_window_from_same_toplevel_window(win1, win2)
Parameters:
  • win1 (int) – first window

  • win2 (int) – second window

Returns:

True is windows are in the same application

Return type:

bool

Checks whether 2 windows have the same topmost window

is_window_transparent(win)
Parameters:

win (int) – window to get the transparent flag from.

Returns:

True if the window is “transparent”

Return type:

bool

lock_group(group)
Parameters:

group (int) – group number for locking

Locks the group. Can be used after xkl_GetXXXGroup functions

pause_listen()
Returns:

0

Return type:

int

Temporary pauses listening for XKB-related events

resume_listen()
Returns:

0

Return type:

int

Resumes listening for XKB-related events

save_state(win, state)
Parameters:
  • win (int) – target window

  • state (Xkl.State) – new state of the window

Stores ths state for a given window

set_default_group(group)
Parameters:

group (int) – default group

Configures the default group set on window creation. If -1, no default group is used

set_group_per_toplevel_window(is_global)
Parameters:

is_global (bool) – new parameter value

Sets the configuration parameter: group per application

set_indicators_handling(whether_handle)
Parameters:

whether_handle (bool) – new parameter value

Sets the configuration parameter: perform indicators handling

set_secondary_groups_mask(mask)
Parameters:

mask (int) – new group mask

Sets the secondary groups (one bit per group). Secondary groups require explicit “allowance” for switching

set_window_transparent(win, transparent)
Parameters:
  • win (int) – window do set the flag for.

  • transparent (bool) – if true, the windows is transparent.

Sets the “transparent” flag. It means focus switching onto this window will never change the state.

start_listen(flags)
Parameters:

flags (int) – any combination of XKLL_* constants

Returns:

0

Return type:

int

Starts listening for XKB-related events

stop_listen(flags)
Parameters:

flags (int) – any combination of XKLL_* constants

Returns:

0

Return type:

int

Stops listening for XKB-related events

ungrab_key(keycode, modifiers)
Parameters:
  • keycode (int) – keycode

  • modifiers (int) – bitmask of modifiers

Returns:

True on success

Return type:

bool

Ungrabs some key

do_config_notify() virtual
do_new_device_notify() virtual
do_new_window_notify(win, parent) virtual
Parameters:
  • win (int) –

  • parent (int) –

Return type:

int

do_state_notify(change_type, group, restore) virtual
Parameters:

Signal Details

Xkl.Engine.signals.X_config_changed(engine)
Signal Name:

X-config-changed

Flags:

RUN_LAST

Parameters:

engine (Xkl.Engine) – The object which received the signal

Xkl.Engine.signals.X_new_device(engine)
Signal Name:

X-new-device

Flags:

RUN_LAST

Parameters:

engine (Xkl.Engine) – The object which received the signal

Xkl.Engine.signals.X_state_changed(engine, object, p0, p1)
Signal Name:

X-state-changed

Flags:

RUN_LAST

Parameters:
Xkl.Engine.signals.new_toplevel_window(engine, object, p0)
Signal Name:

new-toplevel-window

Flags:

RUN_LAST

Parameters:
  • engine (Xkl.Engine) – The object which received the signal

  • object (int) –

  • p0 (int) –

Return type:

int

Property Details

Xkl.Engine.props.backendName
Name:

backendName

Type:

str

Default Value:

None

Flags:

READABLE

Backend name

Xkl.Engine.props.default_group
Name:

default-group

Type:

int

Default Value:

0

Flags:

READABLE

Default group

Xkl.Engine.props.display
Name:

display

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

X xlib.Display pointer

Xkl.Engine.props.features
Name:

features

Type:

Xkl.EngineFeatures

Default Value:

0

Flags:

READABLE

Backend features

Xkl.Engine.props.indicators_handling
Name:

indicators-handling

Type:

bool

Default Value:

False

Flags:

READABLE

Whether engine should handle indicators

Xkl.Engine.props.max_num_groups
Name:

max-num-groups

Type:

int

Default Value:

0

Flags:

READABLE

Max number of groups

Xkl.Engine.props.num_groups
Name:

num-groups

Type:

int

Default Value:

0

Flags:

READABLE

Current number of groups

Xkl.Engine.props.secondary_groups_mask
Name:

secondary-groups-mask

Type:

int

Default Value:

0

Flags:

READABLE

Secondary groups mask