Workspace
Library for monitoring and manipulating the compositor's workspaces, based on the ext-workspace-v1 protocol.
Usage
You can browse the Workspace reference.
CLI
sh
astal-workspace --helpLibrary
The AstalWorkspace library is initialized asynchronously; therefore, all lists (e.g. workspaces) are initially empty. This is usually not an issue. When you bind to these values, your widget will receive updates as soon as the compositor finishes sending the data. However, this means that you won't get the correct data when accessing the library's properties at the top level. You can listen for the "updated" signal to accomodate this.
js
import Workspace from "gi://AstalWorkspace"
const ws = Workspace.get_default()
for (const workspace of ws.workspaces) {
print(workspace.name);
}py
from gi.repository import AstalWorkspace as Workspace
ws = Workspace.get_default()
for workspace in ws.get_workspaces():
print(workspace.get_name())lua
local Workspace = require("lgi").require("AstalWorkspace")
local ws = Workspace.get_default()
for _, workspace in ipairs(ws.workspaces) do
print(workspace.name)
endvala
var ws = AstalWorkspace.get_default();
foreach (var workspace in ws.workspaces) {
print(workspace.name);
}Installation
install dependencies
Note that the library depends on AstalWl, which must be installed before this one.
shsudo pacman -Syu meson vala valadoc json-glib gobject-introspectionshsudo dnf install meson vala valadoc json-glib-devel gobject-introspection-develshsudo apt install meson valac valadoc libjson-glib-dev gobject-introspectionclone repo
shgit clone https://github.com/aylur/astal.git cd astal/lib/workspaceinstall
shmeson setup build meson install -C build