Allow multiple assignments of workspaces to outputs

Also makes get_assigned_output work with the primary output:
    workspace X output primary
will now work.

Fixes #555.
This commit is contained in:
Orestis Floros
2018-03-28 00:55:20 +03:00
parent d525eb80ae
commit bce088679a
10 changed files with 130 additions and 18 deletions

View File

@ -29,6 +29,8 @@ workspace 2 output fake-1
workspace 3:foo output fake-1
workspace baz output fake-1
workspace 5 output left
workspace 6 output doesnotexist fake-0
workspace 7 output fake-1 fake-0
EOT
##########################################################################
@ -91,4 +93,24 @@ cmd 'rename workspace 5 to 2';
is(get_output_for_workspace('2'), 'fake-1',
'Renaming a workspace so that it moves to the focused output which contains only an empty workspace should replace the empty workspace');
##########################################################################
# Renaming a workspace with multiple assignments, where the first output
# doesn't exist.
##########################################################################
cmd 'focus output fake-1';
cmd 'rename workspace to 6';
is(get_output_for_workspace('6'), 'fake-0',
'Renaming the workspace while first target output doesn\'t exist moves it to the second assigned output');
##########################################################################
# Renaming a workspace with multiple assignments, where both outputs exist
# moves it to the first output.
##########################################################################
cmd 'focus output fake-0';
cmd 'rename workspace to 7';
is(get_output_for_workspace('7'), 'fake-1',
'Renaming a workspace with multiple assignments, where both outputs exist moves it to the first output.');
done_testing;