opt: default maximize all client

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

View file

@ -348,8 +348,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,
@ -360,21 +358,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;
@ -1408,6 +1409,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;
@ -1491,6 +1493,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,
@ -1042,6 +1043,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);
@ -2189,8 +2191,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) {
@ -3256,6 +3258,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
@ -3325,10 +3328,6 @@ mapnotify(struct wl_listener *listener, void *data) {
wlr_scene_node_lower_to_bottom(&c->shadow->node);
wlr_scene_node_set_enabled(&c->shadow->node, true);
/* 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,头部入栈
@ -3353,6 +3352,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);
// apply buffer effects of client
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
iter_xdg_scene_buffers, c);