Skip to content

spaces QOL for scripting #307

@eghere

Description

@eghere

Description:
I enjoy using spaces as a replacement for workspaces, as I generally use a few main containers with a few containers I want to load in preset layouts. It has been rather troublesome to script around spaces since there is currently no LUA API. In this enhancement I will propose some ideas which would improve the QOL of making scripts around spaces, ordered by importance.

Deleting spaces
scrollmsg space delete <name>: Right now, there's no way to delete spaces outside of restarting the compositor. This causes the list in scrollmsg -t get_spaces to quickly become cluttered.

LUA API integration for scroll.space()
Usage: scroll.space(mode, name, output)

mode: Represents space action. Can be save, load, restore, restore_hide, or delete
name: Represents the space name
output: An optional argument to specify which monitor should perform the space action. If none is specified, it will use the focused monitor. An example use case for the monitor parameter would be in making scripts to load spaces on multiple monitors; with this feature you would not have to focus each monitor before loading.

Richer get_spaces IPC response
Right now, only a flat array of space names is returned from scrollmsg -t get_spaces. This would be nice to query data about a space without having to load it. A proposed change could look something like:

// Instead of: json_object_new_string(space->name)
// Return an object per space:
json_object *entry = json_object_new_object();
json_object_object_add(entry, "name", json_object_new_string(space->name));
json_object_object_add(entry, "tiling_count",
    json_object_new_int(space->tiling->length));
json_object_object_add(entry, "floating_count",
    json_object_new_int(space->floating->length));

I think something that displays the container ID would suffice here, too. It doesn't need to be too fancy, but would be nice to have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions