mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
fix: windowrule option monitor apply error
This commit is contained in:
parent
b697e94fb4
commit
59c9bbbc90
2 changed files with 23 additions and 12 deletions
|
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
int isunglobal;
|
||||
int isglobal;
|
||||
int isoverlay;
|
||||
int monitor;
|
||||
const char *monitor;
|
||||
int offsetx;
|
||||
int offsety;
|
||||
int width;
|
||||
|
|
@ -1416,7 +1416,7 @@ void parse_config_line(Config *config, const char *line) {
|
|||
rule->isoverlay = -1;
|
||||
rule->isterm = -1;
|
||||
rule->noswallow = -1;
|
||||
rule->monitor = -1;
|
||||
rule->monitor = NULL;
|
||||
rule->offsetx = 0;
|
||||
rule->offsety = 0;
|
||||
rule->nofadein = -1;
|
||||
|
|
@ -1460,7 +1460,7 @@ void parse_config_line(Config *config, const char *line) {
|
|||
} else if (strcmp(key, "tags") == 0) {
|
||||
rule->tags = 1 << (atoi(val) - 1);
|
||||
} else if (strcmp(key, "monitor") == 0) {
|
||||
rule->monitor = atoi(val);
|
||||
rule->monitor = strdup(val);
|
||||
} else if (strcmp(key, "offsetx") == 0) {
|
||||
rule->offsetx = atoi(val);
|
||||
} else if (strcmp(key, "offsety") == 0) {
|
||||
|
|
@ -1953,10 +1953,21 @@ void free_config(void) {
|
|||
if (config.window_rules) {
|
||||
for (int i = 0; i < config.window_rules_count; i++) {
|
||||
ConfigWinRule *rule = &config.window_rules[i];
|
||||
free((void *)rule->id);
|
||||
free((void *)rule->title);
|
||||
free((void *)rule->animation_type_open);
|
||||
free((void *)rule->animation_type_close);
|
||||
if (rule->id)
|
||||
free((void *)rule->id);
|
||||
if (rule->title)
|
||||
free((void *)rule->title);
|
||||
if (rule->animation_type_open)
|
||||
free((void *)rule->animation_type_open);
|
||||
if (rule->animation_type_close)
|
||||
free((void *)rule->animation_type_close);
|
||||
if (rule->monitor)
|
||||
free((void *)rule->monitor);
|
||||
rule->id = NULL;
|
||||
rule->title = NULL;
|
||||
rule->animation_type_open = NULL;
|
||||
rule->animation_type_close = NULL;
|
||||
rule->monitor = NULL;
|
||||
// 释放 globalkeybinding 的 arg.v(如果动态分配)
|
||||
if (rule->globalkeybinding.arg.v) {
|
||||
free((void *)rule->globalkeybinding.arg.v);
|
||||
|
|
|
|||
10
src/maomao.c
10
src/maomao.c
|
|
@ -1104,7 +1104,6 @@ void applyrules(Client *c) {
|
|||
/* rule matching */
|
||||
const char *appid, *title;
|
||||
unsigned int i, newtags = 0;
|
||||
unsigned int mon_idx;
|
||||
const ConfigWinRule *r;
|
||||
Monitor *mon = selmon, *m;
|
||||
Client *fc;
|
||||
|
|
@ -1131,10 +1130,10 @@ void applyrules(Client *c) {
|
|||
newtags |= (r->tags > 0) ? r->tags : 0;
|
||||
|
||||
// set monitor of client
|
||||
mon_idx = 0;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (r->monitor == mon_idx++)
|
||||
if (regex_match(r->monitor, m->wlr_output->name)) {
|
||||
mon = m;
|
||||
}
|
||||
}
|
||||
|
||||
// set geometry of floating client
|
||||
|
|
@ -1193,9 +1192,10 @@ void applyrules(Client *c) {
|
|||
setmon(c, mon, newtags, !c->isopensilent);
|
||||
|
||||
if (!c->isopensilent && c->mon &&
|
||||
!(c->tags & (1 << (c->mon->pertag->curtag - 1)))) {
|
||||
((c->mon && c->mon != selmon) ||
|
||||
!(c->tags & (1 << (c->mon->pertag->curtag - 1))))) {
|
||||
c->animation.tag_from_rule = true;
|
||||
view(&(Arg){.ui = c->tags}, true);
|
||||
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon);
|
||||
}
|
||||
|
||||
setfullscreen(c, fullscreen_state_backup);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue