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 .
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

@@ -116,6 +116,7 @@ is(parser_calls($config),
$config = <<'EOT';
assign [class="^Chrome"] 4
assign [class="^Chrome"] workspace number 3
assign [class="^Chrome"] named workspace
assign [class="^Chrome"] "quoted named workspace"
assign [class="^Chrome"] → "quoted named workspace"
@@ -123,13 +124,15 @@ EOT
$expected = <<'EOT';
cfg_criteria_add(class, ^Chrome)
cfg_assign(4)
cfg_assign(4, 0)
cfg_criteria_add(class, ^Chrome)
cfg_assign(named workspace)
cfg_assign(3, 1)
cfg_criteria_add(class, ^Chrome)
cfg_assign(quoted named workspace)
cfg_assign(named workspace, 0)
cfg_criteria_add(class, ^Chrome)
cfg_assign(quoted named workspace)
cfg_assign(quoted named workspace, 0)
cfg_criteria_add(class, ^Chrome)
cfg_assign(quoted named workspace, 0)
EOT
is(parser_calls($config),