mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-02 09:01:43 -05:00
feat: add dispatch focuslast
This commit is contained in:
parent
4f78c06515
commit
ba763332fc
3 changed files with 29 additions and 1 deletions
|
|
@ -660,6 +660,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
func = tagtoright;
|
||||
} else if (strcmp(func_name, "killclient") == 0) {
|
||||
func = killclient;
|
||||
} else if (strcmp(func_name, "focuslast") == 0) {
|
||||
func = focuslast;
|
||||
} else if (strcmp(func_name, "setlayout") == 0) {
|
||||
func = setlayout;
|
||||
(*arg).v = strdup(arg_value);
|
||||
|
|
|
|||
|
|
@ -57,4 +57,5 @@ void resizewin(const Arg *arg);
|
|||
void toggle_named_scratchpad(const Arg *arg);
|
||||
void toggle_render_border(const Arg *arg);
|
||||
void create_virtual_output(const Arg *arg);
|
||||
void destroy_all_virtual_output(const Arg *arg);
|
||||
void destroy_all_virtual_output(const Arg *arg);
|
||||
void focuslast(const Arg *arg);
|
||||
25
src/maomao.c
25
src/maomao.c
|
|
@ -4549,6 +4549,31 @@ void pending_kill_client(Client *c) {
|
|||
client_send_close(c);
|
||||
}
|
||||
|
||||
void focuslast(const Arg *arg) {
|
||||
|
||||
Client *c, *prev = NULL;
|
||||
wl_list_for_each(c, &fstack, flink) {
|
||||
if (c->iskilling || c->isminied || c->isunglobal)
|
||||
continue;
|
||||
if (c)
|
||||
break;
|
||||
}
|
||||
|
||||
struct wl_list *prev_node = c->flink.next;
|
||||
prev = wl_container_of(prev_node, prev, flink);
|
||||
|
||||
unsigned int target;
|
||||
if (prev) {
|
||||
if (prev->mon != selmon) {
|
||||
selmon = prev->mon;
|
||||
warp_cursor_to_selmon(selmon);
|
||||
}
|
||||
target = get_tags_first_tag(prev->tags);
|
||||
view(&(Arg){.ui = target}, true);
|
||||
focusclient(prev, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void killclient(const Arg *arg) {
|
||||
Client *c;
|
||||
c = selmon->sel;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue