aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-08-12 00:38:19 +0100
committerIan Fan <ianfan0@gmail.com>2018-08-18 17:25:06 +0100
commit23601a8771f6e98e04bb4bfb9dd75ed399a20717 (patch)
treeaf7f151dfb62412efef27f91c5776ec78602a0b5 /sway/tree
parente81cc8a5754386d9484b84cf97ab2f8755c35294 (diff)
commands: complete assign command
Diffstat (limited to 'sway/tree')
-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) {
// Check if there's any `assign` criteria for the view
list_t *criterias = criteria_for_view(view,
- CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT);
+ CT_ASSIGN_WORKSPACE | CT_ASSIGN_WORKSPACE_NUMBER | CT_ASSIGN_OUTPUT);
struct sway_container *ws = NULL;
for (int i = 0; i < criterias->length; ++i) {
struct criteria *criteria = criterias->items[i];
- if (criteria->type == CT_ASSIGN_WORKSPACE) {
- ws = workspace_by_name(criteria->target);
+ if (criteria->type == CT_ASSIGN_OUTPUT) {
+ struct sway_container *output = output_by_name(criteria->target);
+ if (output) {
+ ws = seat_get_active_child(seat, output);
+ break;
+ }
+ } else {
+ // CT_ASSIGN_WORKSPACE(_NUMBER)
+ ws = criteria->type == CT_ASSIGN_WORKSPACE_NUMBER ?
+ workspace_by_number(criteria->target) :
+ workspace_by_name(criteria->target);
+
if (!ws) {
if (strcasecmp(criteria->target, "back_and_forth") == 0) {
if (prev_workspace_name) {
@@ -466,13 +476,6 @@ static struct sway_container *select_workspace(struct sway_view *view) {
}
}
break;
- } else {
- // CT_ASSIGN_OUTPUT
- struct sway_container *output = output_by_name(criteria->target);
- if (output) {
- ws = seat_get_active_child(seat, output);
- break;
- }
}
}
list_free(criterias);