From e86441919428602774e4866119bb57d1f6d34dcc Mon Sep 17 00:00:00 2001 From: Consus Date: Tue, 29 Aug 2023 13:12:09 +0300 Subject: [PATCH] workspaces: allow referencing the current workspace This value allows a user to reference the currently visible workspace. --- docs/labwc-actions.5.scd | 6 +++--- src/workspaces.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index d21a79b8..b5fc6ef4 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -127,9 +127,9 @@ Actions are used in menus and keyboard/mouse bindings. ** Switch to workspace. - *to* The workspace to switch to. Supported values are "last", "left", - "right" or the full name of a workspace or its index (starting at 1) - as configured in rc.xml. + *to* The workspace to switch to. Supported values are "current", "last", + "left", "right" or the full name of a workspace or its index (starting + at 1) as configured in rc.xml. *wrap* [yes|no] Wrap around from last desktop to first, and vice versa. Default yes. diff --git a/src/workspaces.c b/src/workspaces.c index bd9bdab0..89bf030b 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -340,6 +340,8 @@ workspaces_find(struct workspace *anchor, const char *name, bool wrap) return target; } } + } else if (!strcasecmp(name, "current")) { + return anchor; } else if (!strcasecmp(name, "last")) { return anchor->server->workspace_last; } else if (!strcasecmp(name, "left")) {