Compare commits

...

7 commits

Author SHA1 Message Date
DreamMaoMao
8c48e2391b opt: make tag animation more consistent 2025-10-21 16:27:25 +08:00
werapi
10406cebce fix: ensure tag changes happen on correct monitor 2025-10-21 16:11:16 +08:00
DreamMaoMao
f472dfecf5 opt: limit config parse string length to 255 2025-10-21 16:11:16 +08:00
David Delarosa
b5700b1e86 opt: limit scanf string length to 255 2025-10-21 16:11:16 +08:00
Cheetah
c8aa88a9d6 Update Installation on Arch Linux section in README.md
Added better installation instructions for arch
2025-10-21 16:11:16 +08:00
DreamMaoMao
a9f42ad6dc opt: reset master per when setmfact toggle 2025-10-20 18:07:59 +08:00
werapi
568befdd3f opt: make focusmon and tagmon respect warpcursor setting 2025-10-20 18:07:59 +08:00
7 changed files with 58 additions and 39 deletions

View file

@ -65,7 +65,7 @@ https://github.com/user-attachments/assets/c9bf9415-fad1-4400-bcdc-3ad2d76de85a
- pcre2
## Arch Linux
The package is in the Arch User Repository and is availble for manual download [here](https://aur.archlinux.org/packages/mangowc-git) or through a AUR helper like yay:
```bash
yay -S mangowc-git

View file

@ -9,19 +9,23 @@ void set_tagin_animation(Monitor *m, Client *c) {
c->animainit_geom.x = tag_animation_direction == VERTICAL
? c->animation.current.x
: c->mon->m.x + c->mon->m.width;
: MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
c->animainit_geom.y = tag_animation_direction == VERTICAL
? c->mon->m.y + c->mon->m.height
? MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
: c->animation.current.y;
} else {
c->animainit_geom.x = tag_animation_direction == VERTICAL
? c->animation.current.x
: m->m.x - c->geom.width;
c->animainit_geom.y = tag_animation_direction == VERTICAL
? m->m.y - c->geom.height
: c->animation.current.y;
c->animainit_geom.x =
tag_animation_direction == VERTICAL
? c->animation.current.x
: MIN(m->m.x - c->geom.width, c->geom.x - c->mon->m.width);
c->animainit_geom.y =
tag_animation_direction == VERTICAL
? MIN(m->m.y - c->geom.height, c->geom.y - c->mon->m.height)
: c->animation.current.y;
}
}
@ -52,11 +56,13 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
void set_tagout_animation(Monitor *m, Client *c) {
if (m->pertag->curtag > m->pertag->prevtag) {
c->pending = c->geom;
c->pending.x = tag_animation_direction == VERTICAL
? c->animation.current.x
: c->mon->m.x - c->geom.width;
c->pending.x =
tag_animation_direction == VERTICAL
? c->animation.current.x
: MIN(c->mon->m.x - c->geom.width, c->geom.x - c->mon->m.width);
c->pending.y = tag_animation_direction == VERTICAL
? c->mon->m.y - c->geom.height
? MIN(c->mon->m.y - c->geom.height,
c->geom.y - c->mon->m.height)
: c->animation.current.y;
resize(c, c->geom, 0);
@ -64,9 +70,11 @@ void set_tagout_animation(Monitor *m, Client *c) {
c->pending = c->geom;
c->pending.x = tag_animation_direction == VERTICAL
? c->animation.current.x
: c->mon->m.x + c->mon->m.width;
: MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
c->pending.y = tag_animation_direction == VERTICAL
? c->mon->m.y + c->mon->m.height
? MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
: c->animation.current.y;
resize(c, c->geom, 0);
}

View file

@ -1352,14 +1352,6 @@ void parse_option(Config *config, char *key, char *value) {
} else {
convert_hex_to_rgba(config->overlaycolor, color);
}
} else if (strcmp(key, "autostart") == 0) {
if (sscanf(value, "%[^,],%[^,],%[^,]", config->autostart[0],
config->autostart[1], config->autostart[2]) != 3) {
fprintf(stderr, "Error: Invalid autostart format: %s\n", value);
}
trim_whitespace(config->autostart[0]);
trim_whitespace(config->autostart[1]);
trim_whitespace(config->autostart[2]);
} else if (strcmp(key, "tagrule") == 0) {
config->tag_rules =
realloc(config->tag_rules,
@ -1588,7 +1580,7 @@ void parse_option(Config *config, char *key, char *value) {
rule->isfullscreen = atoi(val);
} else if (strcmp(key, "globalkeybinding") == 0) {
char mod_str[256], keysym_str[256];
sscanf(val, "%[^-]-%[a-zA-Z]", mod_str, keysym_str);
sscanf(val, "%255[^-]-%255[a-zA-Z]", mod_str, keysym_str);
trim_whitespace(mod_str);
trim_whitespace(keysym_str);
rule->globalkeybinding.mod = parse_mod(mod_str);
@ -1670,7 +1662,7 @@ void parse_option(Config *config, char *key, char *value) {
} else if (strncmp(key, "env", 3) == 0) {
char env_type[256], env_value[256];
if (sscanf(value, "%[^,],%[^\n]", env_type, env_value) < 2) {
if (sscanf(value, "%255[^,],%255[^\n]", env_type, env_value) < 2) {
fprintf(stderr, "Error: Invalid bind format: %s\n", value);
return;
}
@ -1746,7 +1738,9 @@ void parse_option(Config *config, char *key, char *value) {
arg_value[256] = "0\0", arg_value2[256] = "0\0",
arg_value3[256] = "0\0", arg_value4[256] = "0\0",
arg_value5[256] = "0\0";
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
if (sscanf(value,
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255["
"^,],%255[^\n]",
mod_str, keysym_str, func_name, arg_value, arg_value2,
arg_value3, arg_value4, arg_value5) < 3) {
fprintf(stderr, "Error: Invalid bind format: %s\n", value);
@ -1817,7 +1811,9 @@ void parse_option(Config *config, char *key, char *value) {
arg_value[256] = "0\0", arg_value2[256] = "0\0",
arg_value3[256] = "0\0", arg_value4[256] = "0\0",
arg_value5[256] = "0\0";
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
if (sscanf(value,
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255["
"^,],%255[^\n]",
mod_str, button_str, func_name, arg_value, arg_value2,
arg_value3, arg_value4, arg_value5) < 3) {
fprintf(stderr, "Error: Invalid mousebind format: %s\n", value);
@ -1876,7 +1872,9 @@ void parse_option(Config *config, char *key, char *value) {
arg_value[256] = "0\0", arg_value2[256] = "0\0",
arg_value3[256] = "0\0", arg_value4[256] = "0\0",
arg_value5[256] = "0\0";
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
if (sscanf(value,
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255["
"^,],%255[^\n]",
mod_str, dir_str, func_name, arg_value, arg_value2,
arg_value3, arg_value4, arg_value5) < 3) {
fprintf(stderr, "Error: Invalid axisbind format: %s\n", value);
@ -1938,7 +1936,9 @@ void parse_option(Config *config, char *key, char *value) {
arg_value[256] = "0\0", arg_value2[256] = "0\0",
arg_value3[256] = "0\0", arg_value4[256] = "0\0",
arg_value5[256] = "0\0";
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
if (sscanf(value,
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255["
"^\n]",
fold_str, func_name, arg_value, arg_value2, arg_value3,
arg_value4, arg_value5) < 3) {
fprintf(stderr, "Error: Invalid switchbind format: %s\n", value);
@ -1995,7 +1995,8 @@ void parse_option(Config *config, char *key, char *value) {
arg_value3[256] = "0\0", arg_value4[256] = "0\0",
arg_value5[256] = "0\0";
if (sscanf(value,
"%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255["
"^,],%255[^,],%255[^\n]",
mod_str, motion_str, fingers_count_str, func_name, arg_value,
arg_value2, arg_value3, arg_value4, arg_value5) < 4) {
fprintf(stderr, "Error: Invalid gesturebind format: %s\n", value);
@ -2050,7 +2051,7 @@ void parse_option(Config *config, char *key, char *value) {
void parse_config_line(Config *config, const char *line) {
char key[256], value[256];
if (sscanf(line, "%[^=]=%[^\n]", key, value) != 2) {
if (sscanf(line, "%255[^=]=%255[^\n]", key, value) != 2) {
// fprintf(stderr, "Error: Invalid line format: %s\n", line);
return;
}

View file

@ -191,7 +191,9 @@ int focusmon(const Arg *arg) {
old_selmon_sel = selmon->sel;
selmon = m;
warp_cursor_to_selmon(selmon);
if (warpcursor) {
warp_cursor_to_selmon(selmon);
}
c = focustop(selmon);
if (!c) {
selmon->sel = NULL;
@ -294,6 +296,7 @@ int increase_proportion(const Arg *arg) {
int setmfact(const Arg *arg) {
float f;
Client *c = NULL;
if (!arg || !selmon ||
!selmon->pertag->ltidxs[selmon->pertag->curtag]->arrange)
@ -302,8 +305,13 @@ int setmfact(const Arg *arg) {
: arg->f - 1.0;
if (f < 0.1 || f > 0.9)
return 0;
// selmon->mfact = f;
selmon->pertag->mfacts[selmon->pertag->curtag] = f;
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, selmon) && ISTILED(c)) {
c->master_mfact_per = f;
}
}
arrange(selmon, false);
return 0;
}
@ -1074,7 +1082,9 @@ int tagmon(const Arg *arg) {
focusclient(c, 1);
arrange(selmon, false);
}
warp_cursor_to_selmon(c->mon);
if (warpcursor) {
warp_cursor_to_selmon(c->mon);
}
return 0;
}
@ -1531,4 +1541,4 @@ int toggleoverview(const Arg *arg) {
refresh_monitors_workspaces_status(selmon);
return 0;
}
}

View file

@ -25,7 +25,7 @@ void handle_foreign_activate_request(struct wl_listener *listener, void *data) {
}
target = get_tags_first_tag(c->tags);
view(&(Arg){.ui = target}, true);
view_in_mon(&(Arg){.ui = target}, true, c->mon, true);
focusclient(c, 1);
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
}

View file

@ -12,7 +12,7 @@ void set_size_per(Monitor *m, Client *c) {
}
if (!found) {
c->master_mfact_per = default_mfact;
c->master_mfact_per = m->pertag->mfacts[m->pertag->curtag];
c->master_inner_per = 1.0f;
c->stack_innder_per = 1.0f;
}

View file

@ -5347,7 +5347,7 @@ urgent(struct wl_listener *listener, void *data) {
if (focus_on_activate && !c->istagsilent && c != selmon->sel) {
if (!(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags]))
view(&(Arg){.ui = c->tags}, true);
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true);
focusclient(c, 1);
} else if (c != focustop(selmon)) {
if (client_surface(c)->mapped)
@ -5494,7 +5494,7 @@ void activatex11(struct wl_listener *listener, void *data) {
if (focus_on_activate && !c->istagsilent && c != selmon->sel) {
if (!(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags]))
view(&(Arg){.ui = c->tags}, true);
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true);
wlr_xwayland_surface_activate(c->surface.xwayland, 1);
focusclient(c, 1);
need_arrange = true;