opt: default maximize all client

This commit is contained in:
DreamMaoMao 2025-08-10 12:25:08 +08:00
parent 9ba301ce0f
commit 906c64c041
3 changed files with 14 additions and 18 deletions

View file

@ -350,8 +350,6 @@ static inline uint32_t client_set_size(Client *c, uint32_t width,
static inline void client_set_tiled(Client *c, uint32_t edges) {
struct wlr_xdg_toplevel *toplevel;
struct wlr_xdg_toplevel_state state;
bool need_maximize = false;
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_set_maximized(c->surface.xwayland,
@ -362,21 +360,13 @@ static inline void client_set_tiled(Client *c, uint32_t edges) {
#endif
toplevel = c->surface.xdg->toplevel;
state = toplevel->current;
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
} else {
need_maximize = true;
}
// exclude some windows that cannot be maximized,
// such as the login window of linuxqq
if (state.min_width == 0 || state.min_height == 0)
need_maximize = false;
if (need_maximize) {
if (!c->ignore_maximize) {
wlr_xdg_toplevel_set_maximized(toplevel, edges != WLR_EDGE_NONE);
}
}

View file

@ -50,6 +50,7 @@ typedef struct {
int isunglobal;
int isglobal;
int isoverlay;
int ignore_maximize;
int isnosizehint;
const char *monitor;
int offsetx;
@ -1345,6 +1346,7 @@ void parse_config_line(Config *config, const char *line) {
rule->isunglobal = -1;
rule->isglobal = -1;
rule->isoverlay = -1;
rule->ignore_maximize = -1;
rule->isnosizehint = -1;
rule->isterm = -1;
rule->noswallow = -1;
@ -1427,6 +1429,8 @@ void parse_config_line(Config *config, const char *line) {
rule->focused_opacity = atof(val);
} else if (strcmp(key, "isoverlay") == 0) {
rule->isoverlay = atoi(val);
} else if (strcmp(key, "ignore_maximize") == 0) {
rule->ignore_maximize = atoi(val);
} else if (strcmp(key, "isnosizehint") == 0) {
rule->isnosizehint = atoi(val);
} else if (strcmp(key, "isterm") == 0) {

View file

@ -265,7 +265,8 @@ struct Client {
unsigned int configure_serial;
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
int isfloating, isurgent, isfullscreen, isfakefullscreen,
need_float_size_reduce, isminied, isoverlay, isnosizehint;
need_float_size_reduce, isminied, isoverlay, isnosizehint,
ignore_maximize;
int ismaxmizescreen;
int overview_backup_bw;
int fullscreen_backup_x, fullscreen_backup_y, fullscreen_backup_w,
@ -1052,6 +1053,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
APPLY_INT_PROP(c, r, isnamedscratchpad);
APPLY_INT_PROP(c, r, isglobal);
APPLY_INT_PROP(c, r, isoverlay);
APPLY_INT_PROP(c, r, ignore_maximize);
APPLY_INT_PROP(c, r, isnosizehint);
APPLY_INT_PROP(c, r, isunglobal);
APPLY_INT_PROP(c, r, scratchpad_width);
@ -2141,8 +2143,8 @@ void commitnotify(struct wl_listener *listener, void *data) {
setmon(c, NULL, 0,
true); /* Make sure to reapply rules in mapnotify() */
// client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
// WLR_EDGE_RIGHT);
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
WLR_EDGE_RIGHT);
uint32_t serial = wlr_xdg_surface_schedule_configure(c->surface.xdg);
if (serial > 0) {
@ -3172,6 +3174,7 @@ void init_client_properties(Client *c) {
c->scratchpad_height = 0;
c->isnoborder = 0;
c->isnosizehint = 0;
c->ignore_maximize = 0;
}
void // old fix to 0.5
@ -3245,10 +3248,6 @@ mapnotify(struct wl_listener *listener, void *data) {
c->border[i]->node.data = c;
}
/* Initialize client geometry with room for border */
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
WLR_EDGE_RIGHT);
if (new_is_master && selmon && !is_scroller_layout(selmon))
// tile at the top
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
@ -3273,6 +3272,9 @@ mapnotify(struct wl_listener *listener, void *data) {
applyrules(c);
}
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
WLR_EDGE_RIGHT);
// set border color
setborder_color(c);