Mutter Reference Manual: MetaWorkspace

## MetaWorkspace MetaWorkspace — Workspaces |

## Functions

int | meta_workspace_index ()
MetaScreen * | meta_workspace_get_screen ()
GList * | meta_workspace_list_windows ()
void | meta_workspace_get_work_area_for_monitor ()
void | meta_workspace_get_work_area_all_monitors ()
void | meta_workspace_activate ()
void | meta_workspace_activate_with_focus ()
void | meta_workspace_set_builtin_struts ()
MetaWorkspace * | meta_workspace_get_neighbor ()

## Properties

guint | n-windows | Read
guint | workspace-index | Read

## Signals

void | window-added | Run Last
void | window-removed | Run Last

## Types and Values

| MetaWorkspace
| MetaWorkspaceClass

## Object Hierarchy

        GObject
        ╰── MetaWorkspace

## Description

A workspace is a set of windows which all live on the same screen. (You may also see the name "desktop" around the place, which is the EWMH's name for the same thing.) Only one workspace of a screen may be active at once; all windows on all other workspaces are unmapped.

## Functions

### meta_workspace_index ()

    int
    meta_workspace_index (MetaWorkspace *workspace);

### meta_workspace_get_screen ()

    MetaScreen *
    meta_workspace_get_screen (MetaWorkspace *workspace);

Gets the MetaScreen that the workspace is part of.

#### Parameters

workspace | a MetaWorkspace |

#### Returns

the MetaScreen for the workspace.

[transfer none]

### meta_workspace_list_windows ()

    GList *
    meta_workspace_list_windows (MetaWorkspace *workspace);

Gets windows contained on the workspace, including workspace->windows and also sticky windows. Override-redirect windows are not included.

#### Parameters

workspace | a MetaWorkspace |

#### Returns

the list of windows.

[transfer container][element-type MetaWindow]

### meta_workspace_get_work_area_for_monitor ()

    void
    meta_workspace_get_work_area_for_monitor
                                   (MetaWorkspace *workspace,
                                    int which_monitor,
                                    MetaRectangle *area);

Stores the work area for `which_monitor` on `workspace` in `area` .

#### Parameters

workspace | a MetaWorkspace |
which_monitor | a monitor index |
area | location to store the work area. | [out]

### meta_workspace_get_work_area_all_monitors ()

    void
    meta_workspace_get_work_area_all_monitors
                                   (MetaWorkspace *workspace,
                                    MetaRectangle *area);

Stores the work area in `area` .

#### Parameters

workspace | a MetaWorkspace |
area | location to store the work area. | [out]

### meta_workspace_activate ()

    void
    meta_workspace_activate (MetaWorkspace *workspace,
                             guint32 timestamp);

### meta_workspace_activate_with_focus ()

    void
    meta_workspace_activate_with_focus (MetaWorkspace *workspace,
                                        MetaWindow *focus_this,
                                        guint32 timestamp);

Switches to `workspace` and possibly activates the window `focus_this` .

The window `focus_this` is activated by calling `meta_window_activate()` which will unminimize it and transient parents, raise it and give it the focus.

If a window is currently being moved by the user, it will be moved to `workspace` .

The advantage of calling this function instead of `meta_workspace_activate()` followed by `meta_window_activate()` is that it happens as a unit, so no other window gets focused first before `focus_this` .

#### Parameters

workspace | a MetaWorkspace |
focus_this | the MetaWindow to be focused, or `NULL` |
timestamp | timestamp for `focus_this` |

### meta_workspace_set_builtin_struts ()

    void
    meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
                                       GSList *struts);

Sets a list of struts that will be used in addition to the struts of the windows in the workspace when computing the work area of the workspace.

#### Parameters

workspace | a MetaWorkspace |
struts | list of MetaStrut. | [element-type Meta.Strut][transfer none]

### meta_workspace_get_neighbor ()

    MetaWorkspace *
    meta_workspace_get_neighbor (MetaWorkspace *workspace,
                                 MetaMotionDirection direction);

Calculate and retrive the workspace that is next to `workspace` , according to `direction` and the current workspace layout, as set by `meta_screen_override_workspace_layout()`.

#### Parameters

workspace | a MetaWorkspace |
direction | a MetaMotionDirection, relative to `workspace` |

#### Returns

the workspace next to `workspace` , or `workspace` itself if the neighbor would be outside the layout.

[transfer none]

## Types and Values

### MetaWorkspace

    typedef struct _MetaWorkspace MetaWorkspace;

### MetaWorkspaceClass

    typedef struct _MetaWorkspaceClass MetaWorkspaceClass;

## Property Details

### The `“n-windows”` property

      “n-windows”                guint

Number of windows.

Flags: Read

Default value: 0

### The `“workspace-index”` property

      “workspace-index”          guint

The workspace's index.

Flags: Read

Default value: 0

## Signal Details

### The `“window-added”` signal

    void
    user_function (MetaWorkspace *metaworkspace,
                   MetaWindow    *arg1,
                   gpointer       user_data)

Flags: Run Last

### The `“window-removed”` signal

    void
    user_function (MetaWorkspace *metaworkspace,
                   MetaWindow    *arg1,
                   gpointer       user_data)

Flags: Run Last