mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-26 21:37:31 -04:00
feat: add consume & expel for scroller stack
This commit is contained in:
parent
42c02e3dc2
commit
9367499e49
3 changed files with 40 additions and 1 deletions
|
|
@ -537,6 +537,10 @@ int32_t parse_direction(const char *str) {
|
||||||
return LEFT;
|
return LEFT;
|
||||||
} else if (strcmp(lowerStr, "right") == 0) {
|
} else if (strcmp(lowerStr, "right") == 0) {
|
||||||
return RIGHT;
|
return RIGHT;
|
||||||
|
} else if (strcmp(lowerStr, "consume") == 0) {
|
||||||
|
return CONSUME;
|
||||||
|
} else if (strcmp(lowerStr, "expel") == 0) {
|
||||||
|
return EXPEL;
|
||||||
} else {
|
} else {
|
||||||
return UNDIR;
|
return UNDIR;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1855,6 +1855,41 @@ int32_t scroller_stack(const Arg *arg) {
|
||||||
if (!c || !c->mon || c->isfloating || !is_scroller_layout(selmon))
|
if (!c || !c->mon || c->isfloating || !is_scroller_layout(selmon))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (arg->i == CONSUME) {
|
||||||
|
bool is_horizontal_layout =
|
||||||
|
c->mon->pertag->ltidxs[c->mon->pertag->curtag]->id == SCROLLER;
|
||||||
|
int32_t consume_dir = is_horizontal_layout ? RIGHT : DOWN;
|
||||||
|
|
||||||
|
Client *target_client = find_client_by_direction(c, &(Arg){.i = consume_dir}, false, true);
|
||||||
|
|
||||||
|
if (target_client) {
|
||||||
|
Client *stack_tail = get_scroll_stack_head(c);
|
||||||
|
while (stack_tail->next_in_stack) {
|
||||||
|
stack_tail = stack_tail->next_in_stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
scroller_insert_stack(target_client, stack_tail, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg->i == EXPEL) {
|
||||||
|
Client *stack_head = get_scroll_stack_head(c);
|
||||||
|
Client *stack_tail = stack_head;
|
||||||
|
|
||||||
|
while (stack_tail->next_in_stack) {
|
||||||
|
stack_tail = stack_tail->next_in_stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack_tail != stack_head) {
|
||||||
|
exit_scroller_stack(stack_tail);
|
||||||
|
wl_list_remove(&stack_tail->link);
|
||||||
|
wl_list_insert(&stack_head->link, &stack_tail->link);
|
||||||
|
arrange(selmon, false, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Client *target_client = find_client_by_direction(c, arg, false, true);
|
Client *target_client = find_client_by_direction(c, arg, false, true);
|
||||||
|
|
||||||
return scroller_apply_stack(c, target_client, arg->i);
|
return scroller_apply_stack(c, target_client, arg->i);
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ enum {
|
||||||
NetLast
|
NetLast
|
||||||
}; /* EWMH atoms */
|
}; /* EWMH atoms */
|
||||||
#endif
|
#endif
|
||||||
enum { UP, DOWN, LEFT, RIGHT, UNDIR }; /* smartmovewin */
|
enum { UP, DOWN, LEFT, RIGHT, UNDIR, CONSUME, EXPEL }; /* smartmovewin */
|
||||||
enum { NONE, OPEN, MOVE, CLOSE, TAG, FOCUS, OPAFADEIN, OPAFADEOUT };
|
enum { NONE, OPEN, MOVE, CLOSE, TAG, FOCUS, OPAFADEIN, OPAFADEOUT };
|
||||||
enum { UNFOLD, FOLD, INVALIDFOLD };
|
enum { UNFOLD, FOLD, INVALIDFOLD };
|
||||||
enum { PREV, NEXT };
|
enum { PREV, NEXT };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue