Allow assign to workspace by number

Makes "assign [<criteria>] workspace number <number>" work in the same
manner as "move to workspace number <number>" instead of assigning the
window to a workspace named "number <number>".

config.spec is modified to expect a 'number' string and an extra
argument is used in cfg_assign.

For workspaces that don't exist yet, workspace_get is used as a
fallback. This also allows the user to assign to "<number> <workspace>"
eg "2: work" and the full name will be used if workspace number 2
doesn't exist yet.

Fixes #2590.
This commit is contained in:
Orestis Floros
2017-08-28 05:14:03 +03:00
parent 0f2bce3916
commit eaf7a49e28
8 changed files with 135 additions and 35 deletions

View File

@ -766,7 +766,7 @@ considered.
*Syntax*:
------------------------------------------------------------
assign <criteria> [→] [workspace] <workspace>
assign <criteria> [→] [workspace] [number] <workspace>
------------------------------------------------------------
*Examples*:
@ -783,6 +783,12 @@ assign [class="^URxvt$"] → 2
# Assignment to a named workspace
assign [class="^URxvt$"] → work
# Assign to the workspace with number 2, regardless of name
assign [class="^URxvt$"] → number 2
# You can also specify a number + name. If the workspace with number 2 exists, assign will skip the text part.
assign [class="^URxvt$"] → number "2: work"
# Start urxvt -name irssi
assign [class="^URxvt$" instance="^irssi$"] → 3
----------------------