diff --git a/config.conf b/config.conf index aeef1f3b..4910f69d 100644 --- a/config.conf +++ b/config.conf @@ -95,7 +95,7 @@ tags=id:9,layout_name:tile # isfloating: type-num(0 or 1) # isfullscreen: type-num(0 or 1) # scroller_proportion: type-float(0.1-1.0) -# animation_type_open : type-string(zoom,slide) +# animation_type_open : type-string(zoom,slide,none) # animation_type_close : type-string(zoom,slide) # isnoborder : type-num(0 or 1) # monitor : type-int(0-99999) @@ -265,7 +265,9 @@ bind=ALT+SHIFT,Z,incgaps,-1 bind=ALT+SHIFT,R,togglegaps #custom app bind example -# bind=SUPER,Return,spawn,google-chrome +# spawn_on_empty (if tag 4 is empty , open app in this,otherwise view to tag 4) +# bind=SUPER,Return,spawn_on_empty,google-chrome,4 +# spawn # bind=CTRL+ALT,Return,spawn,st -e ~/tool/ter-multiplexer.sh # Mouse Button Bindings diff --git a/maomao.c b/maomao.c index 5adcfac3..63cb0571 100644 --- a/maomao.c +++ b/maomao.c @@ -234,7 +234,6 @@ struct Client { struct wl_listener set_decoration_mode; struct wl_listener destroy_decoration; - unsigned int ignore_clear_fullscreen; const char *animation_type_open; const char *animation_type_close; int is_in_scratchpad; @@ -1529,10 +1528,6 @@ applyrules(Client *c) { // 重新计算居中的坐标 c->geom = setclient_coordinate_center(c->geom); } - if (r->isfullscreen && r->isfullscreen > 0) { - c->isfullscreen = 1; - c->ignore_clear_fullscreen = 1; - } } } @@ -1557,19 +1552,17 @@ applyrules(Client *c) { wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]); - setmon(c, mon, newtags); Client *fc; // 如果当前的tag中有新创建的非悬浮窗口,就让当前tag中的全屏窗口退出全屏参与平铺 - wl_list_for_each(fc, &clients, link) if (fc && !c->ignore_clear_fullscreen && + wl_list_for_each(fc, &clients, link) if (fc && fc != c && c->tags & fc->tags && ISFULLSCREEN(fc) && !c->isfloating) { clear_fullscreen_flag(fc); arrange(c->mon, false); } - else if (c->ignore_clear_fullscreen && c->isfullscreen) { - setfullscreen(c, 1); - } + + setmon(c, mon, newtags); if (!(c->tags & (1 << (selmon->pertag->curtag - 1)))) { c->animation.from_rule = true; @@ -3753,10 +3746,8 @@ mapnotify(struct wl_listener *listener, void *data) { c->ismaxmizescreen = 0; c->isfullscreen = 0; c->istiled = 0; - c->ignore_clear_fullscreen = 0; c->iskilling = 0; c->scroller_proportion = scroller_default_proportion; - c->is_open_animation = true; // nop if (new_is_master && strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name, @@ -3795,6 +3786,9 @@ mapnotify(struct wl_listener *listener, void *data) { if (c->foreign_toplevel) wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true); + // make sure the animation is open type + c->is_open_animation = true; + resize(c,c->geom,0); printstatus(); } @@ -5370,6 +5364,25 @@ void spawn(const Arg *arg) { } } +void spawn_on_empty(const Arg *arg) { + bool is_empty = true; + Client *c; + + wl_list_for_each(c, &clients, link) { + if (arg->ui & c->tags) { + is_empty = false; + break; + } + } + if(!is_empty) { + view(arg,true); + return; + } else { + view(arg,true); + spawn(arg); + } +} + void startdrag(struct wl_listener *listener, void *data) { struct wlr_drag *drag = data; if (!drag->icon) @@ -5855,6 +5868,16 @@ void set_proportion(const Arg *arg) { } } +void increase_proportion(const Arg *arg) { + if (selmon->sel) { + unsigned int max_client_width = + selmon->w.width - 2 * scroller_structs - gappih; + selmon->sel->scroller_proportion = MIN(MAX(arg->f + selmon->sel->scroller_proportion,0.1),1.0); + selmon->sel->geom.width = max_client_width * arg->f; + arrange(selmon, false); + } +} + // 显示所有tag 或 跳转到聚焦窗口的tag void toggleoverview(const Arg *arg) { diff --git a/parse_config.h b/parse_config.h index f9587212..5706053e 100644 --- a/parse_config.h +++ b/parse_config.h @@ -402,6 +402,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value) { } else if (strcmp(func_name, "set_proportion") == 0) { func = set_proportion; (*arg).f = atof(arg_value); + } else if (strcmp(func_name, "increase_proportion") == 0) { + func = increase_proportion; + (*arg).f = atof(arg_value); } else if (strcmp(func_name, "switch_proportion_preset") == 0) { func = switch_proportion_preset; } else if (strcmp(func_name, "viewtoleft") == 0) { @@ -446,6 +449,15 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value) { } else if (strcmp(func_name, "spawn") == 0) { func = spawn; (*arg).v = strdup(arg_value); + } else if (strcmp(func_name, "spawn_on_empty") == 0) { + char cmd[256],tag_num[256]; + if (sscanf(arg_value, "%255[^,],%255s", cmd, tag_num) == 2) { + func = spawn_on_empty; + (*arg).v = strdup(cmd); // 注意:之后需要释放这个内存 + (*arg).ui = 1 << (atoi(tag_num) - 1); + } else { + fprintf(stderr, "Error: Invalid value format: %s\n", arg_value); + } } else if (strcmp(func_name, "quit") == 0) { func = quit; } else if (strcmp(func_name, "moveresize") == 0) {