WnckWorkspace

## WnckWorkspace WnckWorkspace — an object representing a workspace. |

## Stability Level

Unstable, unless otherwise indicated

## Functions

WnckScreen * | wnck_workspace_get_screen ()
int | wnck_workspace_get_number ()
const char * | wnck_workspace_get_name ()
void | wnck_workspace_change_name ()
int | wnck_workspace_get_width ()
int | wnck_workspace_get_height ()
int | wnck_workspace_get_viewport_x ()
int | wnck_workspace_get_viewport_y ()
gboolean | wnck_workspace_is_virtual ()
int | wnck_workspace_get_layout_row ()
int | wnck_workspace_get_layout_column ()
WnckWorkspace * | wnck_workspace_get_neighbor ()
void | wnck_workspace_activate ()

## Signals

void | name-changed | Run Last

## Types and Values

| WnckWorkspace
enum | WnckMotionDirection

## Object Hierarchy

        GObject
        ╰── WnckWorkspace

## Includes

    #include <libwnck/libwnck.h>

## Description

The WnckWorkspace represents what is called virtual desktops in the EWMH. A workspace is a virtualization of a WnckScreen: only one workspace can be shown on a WnckScreen at a time. It makes it possible, for example, to put windows on different workspaces to organize them.

If the WnckWorkspace size is bigger that the WnckScreen size, the workspace contains a viewport. Viewports are defined in the large desktops section of the EWMH. The notion of workspaces and viewports are quite similar, and generally both are not used at the same time: there are generally either multiple workspaces with no viewport, or one workspace with a viewport. libwnck supports all situations, even multiple workspaces with viewports.

Workspaces are organized according to a layout set on the WnckScreen. See `wnck_screen_try_set_workspace_layout()` and `wnck_screen_release_workspace_layout()` for more information about the layout.

The WnckWorkspace objects are always owned by libwnck and must not be referenced or unreferenced.

## Functions

### wnck_workspace_get_screen ()

    WnckScreen *
    wnck_workspace_get_screen (WnckWorkspace *space);

Gets the WnckScreen `space` is on.

#### Parameters

space | a WnckWorkspace. |

#### Returns

the WnckScreen `space` is on. The returned WnckScreen is owned by libwnck and must not be referenced or unreferenced.

[transfer none]

### wnck_workspace_get_number ()

    int
    wnck_workspace_get_number (WnckWorkspace *space);

Gets the index of `space` on the WnckScreen to which it belongs. The first workspace has an index of 0.

#### Parameters

space | a WnckWorkspace. |

#### Returns

the index of `space` on its WnckScreen, or -1 on errors.

### wnck_workspace_get_name ()

    const char *
    wnck_workspace_get_name (WnckWorkspace *space);

Gets the human-readable name that should be used to refer to `space` . If the user has not set a special name, a fallback like "Workspace 3" will be used.

#### Parameters

space | a WnckWorkspace. |

#### Returns

the name of `space` .

### wnck_workspace_change_name ()

    void
    wnck_workspace_change_name (WnckWorkspace *space,
                                const char *name);

Changes the name of `space` .

#### Parameters

space | a WnckWorkspace. |
name | new name for `space` . |

Since: 2.2

### wnck_workspace_get_width ()

    int
    wnck_workspace_get_width (WnckWorkspace *space);

Gets the width of `space` .

#### Parameters

space | a WnckWorkspace. |

#### Returns

the width of `space` .

Since: 2.4

### wnck_workspace_get_height ()

    int
    wnck_workspace_get_height (WnckWorkspace *space);

Gets the height of `space` .

#### Parameters

space | a WnckWorkspace. |

#### Returns

the height of `space` .

Since: 2.4

### wnck_workspace_get_viewport_x ()

    int
    wnck_workspace_get_viewport_x (WnckWorkspace *space);

Gets the X coordinate of the viewport in `space` .

#### Parameters

space | a WnckWorkspace. |

#### Returns

the X coordinate of the viewport in `space` , or 0 if `space` does not contain a viewport.

Since: 2.4

### wnck_workspace_get_viewport_y ()

    int
    wnck_workspace_get_viewport_y (WnckWorkspace *space);

Gets the Y coordinate of the viewport in `space` .

#### Parameters

space | a WnckWorkspace. |

#### Returns

the Y coordinate of the viewport in `space` , or 0 if `space` does not contain a viewport.

Since: 2.4

### wnck_workspace_is_virtual ()

    gboolean
    wnck_workspace_is_virtual (WnckWorkspace *space);

Gets whether `space` contains a viewport.

#### Parameters

space | a WnckWorkspace. |

#### Returns

`TRUE` if `space` contains a viewport, `FALSE` otherwise.

Since: 2.4

### wnck_workspace_get_layout_row ()

    int
    wnck_workspace_get_layout_row (WnckWorkspace *space);

Gets the row of `space` in the WnckWorkspace layout. The first row has an index of 0 and is always the top row, regardless of the starting corner set for the layout.

#### Parameters

space | a WnckWorkspace. |

#### Returns

the row of `space` in the WnckWorkspace layout, or -1 on errors.

Since: 2.20

### wnck_workspace_get_layout_column ()

    int
    wnck_workspace_get_layout_column (WnckWorkspace *space);

Gets the column of `space` in the WnckWorkspace layout. The first column has an index of 0 and is always the left column, regardless of the starting corner set for the layout and regardless of the default direction of the environment (i.e., in both Left-To-Right and Right-To-Left environments).

#### Parameters

space | a WnckWorkspace. |

#### Returns

the column of `space` in the WnckWorkspace layout, or -1 on errors.

Since: 2.20

### wnck_workspace_get_neighbor ()

    WnckWorkspace *
    wnck_workspace_get_neighbor (WnckWorkspace *space,
                                 WnckMotionDirection direction);

Gets the neighbor WnckWorkspace of `space` in the `direction` direction.

#### Parameters

space | a WnckWorkspace. |
direction | direction in which to search the neighbor. |

#### Returns

the neighbor WnckWorkspace of `space` in the `direction` direction, or `NULL` if no such neighbor WnckWorkspace exists. The returned WnckWorkspace is owned by libwnck and must not be referenced or unreferenced.

[transfer none]

Since: 2.20

### wnck_workspace_activate ()

    void
    wnck_workspace_activate (WnckWorkspace *space,
                             guint32 timestamp);

Asks the window manager to make `space` the active workspace. The window manager may decide to refuse the request (to not steal the focus if there is a more recent user activity, for example).

This function existed before 2.10, but the `timestamp` argument was missing in earlier versions.

#### Parameters

space | a WnckWorkspace. |
timestamp | the X server timestamp of the user interaction event that caused this call to occur. |

Since: 2.10

## Types and Values

### WnckWorkspace

    typedef struct _WnckWorkspace WnckWorkspace;

The WnckWorkspace struct contains only private fields and should not be directly accessed.

### enum WnckMotionDirection

Type defining a direction in which to search a neighbor WnckWorkspace.

#### Members

WNCK_MOTION_UP | search a neighbor WnckWorkspace above another WnckWorkspace. |
WNCK_MOTION_DOWN | search a neighbor WnckWorkspace below another WnckWorkspace. |
WNCK_MOTION_LEFT | search a neighbor WnckWorkspace at the left of another WnckWorkspace. |
WNCK_MOTION_RIGHT | search a neighbor WnckWorkspace at the right of another WnckWorkspace. |

Since: 2.14

## Signal Details

### The `“name-changed”` signal

    void
    user_function (WnckWorkspace *space,
                   gpointer       user_data)

Emitted when the name of `space` changes.

#### Parameters

space | the WnckWorkspace which emitted the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

## See Also

WnckScreen