aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-08-12 00:38:19 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-08-18 17:25:06 +0100
commit23601a8771f6e98e04bb4bfb9dd75ed399a20717 (patch)
treeaf7f151dfb62412efef27f91c5776ec78602a0b5 /sway/tree/view.c
parentcommands: saner workspace number handling (diff)
downloadsway-23601a8771f6e98e04bb4bfb9dd75ed399a20717.tar.gz
sway-23601a8771f6e98e04bb4bfb9dd75ed399a20717.tar.zst
sway-23601a8771f6e98e04bb4bfb9dd75ed399a20717.zip
commands: complete assign command
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 4495c150..4c8e1774 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -450,12 +450,22 @@ static struct sway_container *select_workspace(struct sway_view *view) {
450 450
451 // Check if there's any `assign` criteria for the view 451 // Check if there's any `assign` criteria for the view
452 list_t *criterias = criteria_for_view(view, 452 list_t *criterias = criteria_for_view(view,
453 CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT); 453 CT_ASSIGN_WORKSPACE | CT_ASSIGN_WORKSPACE_NUMBER | CT_ASSIGN_OUTPUT);
454 struct sway_container *ws = NULL; 454 struct sway_container *ws = NULL;
455 for (int i = 0; i < criterias->length; ++i) { 455 for (int i = 0; i < criterias->length; ++i) {
456 struct criteria *criteria = criterias->items[i]; 456 struct criteria *criteria = criterias->items[i];
457 if (criteria->type == CT_ASSIGN_WORKSPACE) { 457 if (criteria->type == CT_ASSIGN_OUTPUT) {
458 ws = workspace_by_name(criteria->target); 458 struct sway_container *output = output_by_name(criteria->target);
459 if (output) {
460 ws = seat_get_active_child(seat, output);
461 break;
462 }
463 } else {
464 // CT_ASSIGN_WORKSPACE(_NUMBER)
465 ws = criteria->type == CT_ASSIGN_WORKSPACE_NUMBER ?
466 workspace_by_number(criteria->target) :
467 workspace_by_name(criteria->target);
468
459 if (!ws) { 469 if (!ws) {
460 if (strcasecmp(criteria->target, "back_and_forth") == 0) { 470 if (strcasecmp(criteria->target, "back_and_forth") == 0) {
461 if (prev_workspace_name) { 471 if (prev_workspace_name) {
@@ -466,13 +476,6 @@ static struct sway_container *select_workspace(struct sway_view *view) {
466 } 476 }
467 } 477 }
468 break; 478 break;
469 } else {
470 // CT_ASSIGN_OUTPUT
471 struct sway_container *output = output_by_name(criteria->target);
472 if (output) {
473 ws = seat_get_active_child(seat, output);
474 break;
475 }
476 } 479 }
477 } 480 }
478 list_free(criterias); 481 list_free(criterias);