mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-09 13:29:54 -05:00
feat:add windowrule option isopensilent and tagsilent dispatch
This commit is contained in:
parent
47c1a7e328
commit
8bfbd0c546
4 changed files with 42 additions and 13 deletions
40
maomao.c
40
maomao.c
|
|
@ -238,6 +238,7 @@ struct Client {
|
|||
int is_scratchpad_show;
|
||||
int isglobal;
|
||||
int isnoborder;
|
||||
int isopensilent;
|
||||
int iskilling;
|
||||
struct wlr_box bounds;
|
||||
bool resizing;
|
||||
|
|
@ -513,7 +514,7 @@ static void setfullscreen(Client *c, int fullscreen);
|
|||
static void setmaxmizescreen(Client *c, int maxmizescreen);
|
||||
static void setgaps(int oh, int ov, int ih, int iv);
|
||||
|
||||
static void setmon(Client *c, Monitor *m, unsigned int newtags);
|
||||
static void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus);
|
||||
static void setpsel(struct wl_listener *listener, void *data);
|
||||
static void setsel(struct wl_listener *listener, void *data);
|
||||
static void setup(void);
|
||||
|
|
@ -1525,6 +1526,7 @@ applyrules(Client *c) {
|
|||
? r->scroller_proportion
|
||||
: c->scroller_proportion;
|
||||
c->isnoborder = r->isnoborder > 0 ? r->isnoborder : c->isnoborder;
|
||||
c->isopensilent = r->isopensilent > 0 ? r->isopensilent : c->isopensilent;
|
||||
newtags = r->tags > 0 ? r->tags | newtags : newtags;
|
||||
i = 0;
|
||||
wl_list_for_each(m, &mons, link) if (r->monitor == i++) mon = m;
|
||||
|
|
@ -1566,9 +1568,9 @@ applyrules(Client *c) {
|
|||
arrange(c->mon, false);
|
||||
}
|
||||
|
||||
setmon(c, mon, newtags);
|
||||
setmon(c, mon, newtags,!c->isopensilent);
|
||||
|
||||
if (!(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
|
||||
if (!c->isopensilent && !(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
|
||||
c->animation.from_rule = true;
|
||||
view(&(Arg){.ui = c->tags}, true);
|
||||
}
|
||||
|
|
@ -2224,7 +2226,7 @@ buttonpress(struct wl_listener *listener, void *data) {
|
|||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
setmon(grabc, selmon, 0,true);
|
||||
grabc = NULL;
|
||||
return;
|
||||
} else {
|
||||
|
|
@ -2361,7 +2363,7 @@ void closemon(Monitor *m) // 0.5
|
|||
.height = c->geom.height},
|
||||
0);
|
||||
if (c->mon == m) {
|
||||
setmon(c, selmon, c->tags);
|
||||
setmon(c, selmon, c->tags,true);
|
||||
reset_foreign_tolevel(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -3937,7 +3939,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||
* try to apply rules for them */
|
||||
if ((p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
setmon(c, p->mon, p->tags);
|
||||
setmon(c, p->mon, p->tags,true);
|
||||
} else {
|
||||
applyrules(c);
|
||||
}
|
||||
|
|
@ -3948,7 +3950,6 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||
if (selmon->sel && selmon->sel->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
||||
false);
|
||||
selmon->sel = c;
|
||||
if (c->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
|
||||
|
||||
|
|
@ -5095,7 +5096,7 @@ void setsmfact(const Arg *arg) {
|
|||
}
|
||||
|
||||
void
|
||||
setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||
setmon(Client *c, Monitor *m, uint32_t newtags,bool focus)
|
||||
{
|
||||
Monitor *oldmon = c->mon;
|
||||
|
||||
|
|
@ -5114,7 +5115,8 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
|||
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
||||
setfloating(c, c->isfloating);
|
||||
}
|
||||
focusclient(focustop(selmon), 1);
|
||||
if(focus)
|
||||
focusclient(focustop(selmon), 1);
|
||||
}
|
||||
|
||||
void // 17
|
||||
|
|
@ -5636,6 +5638,20 @@ void tag(const Arg *arg) {
|
|||
tag_client(arg, target_client);
|
||||
}
|
||||
|
||||
void tagsilent(const Arg *arg) {
|
||||
Client *fc;
|
||||
Client *target_client = selmon->sel;
|
||||
target_client->tags = arg->ui & TAGMASK;
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (fc && fc != target_client && target_client->tags & fc->tags &&
|
||||
ISFULLSCREEN(fc) && !target_client->isfloating) {
|
||||
clear_fullscreen_flag(fc);
|
||||
}
|
||||
}
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(target_client->mon, false);
|
||||
}
|
||||
|
||||
void tagmon(const Arg *arg) {
|
||||
Client *c = focustop(selmon);
|
||||
Monitor *m;
|
||||
|
|
@ -5644,7 +5660,7 @@ void tagmon(const Arg *arg) {
|
|||
selmon->sel = NULL;
|
||||
}
|
||||
m = dirtomon(arg->i);
|
||||
setmon(c, m, 0);
|
||||
setmon(c, m, 0,true);
|
||||
reset_foreign_tolevel(c);
|
||||
// 重新计算居中的坐标
|
||||
if (c->isfloating) {
|
||||
|
|
@ -6425,7 +6441,7 @@ void unmapnotify(struct wl_listener *listener, void *data) {
|
|||
} else {
|
||||
if (!c->swallowing)
|
||||
wl_list_remove(&c->link);
|
||||
setmon(c, NULL, 0);
|
||||
setmon(c, NULL, 0,true);
|
||||
if (!c->swallowing)
|
||||
wl_list_remove(&c->flink);
|
||||
}
|
||||
|
|
@ -6538,7 +6554,7 @@ updatemons(struct wl_listener *listener, void *data) {
|
|||
if (selmon && selmon->wlr_output->enabled) {
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!c->mon && client_surface(c)->mapped) {
|
||||
setmon(c, selmon, c->tags);
|
||||
setmon(c, selmon, c->tags,true);
|
||||
reset_foreign_tolevel(c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue