diff --git a/src/config/parse_config.h b/src/config/parse_config.h index c9ff9a4..4427648 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -149,6 +149,7 @@ typedef struct { int focus_cross_monitor; int focus_cross_tag; int no_border_when_single; + int no_radius_when_single; int snap_distance; int enable_floating_snap; int drag_tile_to_tile; @@ -926,6 +927,8 @@ void parse_config_line(Config *config, const char *line) { config->syncobj_enable = atoi(value); } else if (strcmp(key, "no_border_when_single") == 0) { config->no_border_when_single = atoi(value); + } else if (strcmp(key, "no_radius_when_single") == 0) { + config->no_radius_when_single = atoi(value); } else if (strcmp(key, "snap_distance") == 0) { config->snap_distance = atoi(value); } else if (strcmp(key, "enable_floating_snap") == 0) { @@ -2049,6 +2052,7 @@ void override_config(void) { snap_distance = CLAMP_INT(config.snap_distance, 0, 99999); cursor_size = CLAMP_INT(config.cursor_size, 4, 512); no_border_when_single = CLAMP_INT(config.no_border_when_single, 0, 1); + no_radius_when_single = CLAMP_INT(config.no_radius_when_single, 0, 1); cursor_hide_timeout = CLAMP_INT(config.cursor_hide_timeout, 0, 36000); // 0-10小时 drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1); @@ -2178,6 +2182,7 @@ void set_value_default() { config.xwayland_persistence = xwayland_persistence; config.syncobj_enable = syncobj_enable; config.no_border_when_single = no_border_when_single; + config.no_radius_when_single = no_radius_when_single; config.snap_distance = snap_distance; config.drag_tile_to_tile = drag_tile_to_tile; config.enable_floating_snap = enable_floating_snap; diff --git a/src/config/preset.h b/src/config/preset.h index e898689..10740ee 100644 --- a/src/config/preset.h +++ b/src/config/preset.h @@ -56,6 +56,7 @@ int scroller_prefer_center = 0; int focus_cross_monitor = 0; int focus_cross_tag = 0; int no_border_when_single = 0; +int no_radius_when_single = 0; int snap_distance = 30; int enable_floating_snap = 0; int drag_tile_to_tile = 0; diff --git a/src/maomao.c b/src/maomao.c index f3be54a..2b99fed 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -1096,10 +1096,14 @@ void client_draw_shadow(Client *c) { } void apply_border(Client *c) { - if (c->iskilling || !client_surface(c)->mapped) + if (!c || c->iskilling || !client_surface(c)->mapped) return; bool hit_no_border = check_hit_no_border(c); + enum corner_location current_corner_location = + c->mon->visible_clients == 1 && no_radius_when_single + ? CORNER_LOCATION_NONE + : CORNER_LOCATION_ALL; // Handle no-border cases if (hit_no_border && smartgaps) { @@ -1163,14 +1167,14 @@ void apply_border(Client *c) { .area = {inner_surface_x, inner_surface_y, inner_surface_width, inner_surface_height}, .corner_radius = border_radius, - .corners = CORNER_LOCATION_ALL, + .corners = current_corner_location, }; wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); wlr_scene_rect_set_size(c->border, rect_width, rect_height); wlr_scene_node_set_position(&c->border->node, rect_x, rect_y); wlr_scene_rect_set_corner_radius(c->border, border_radius, - CORNER_LOCATION_ALL); + current_corner_location); wlr_scene_rect_set_clipped_region(c->border, clipped_region); } @@ -5122,6 +5126,10 @@ void buffer_set_effect(Client *c, animationScale data) { if (c == grabc) data.should_scale = false; + if (c->mon->visible_clients == 1 && no_radius_when_single) { + data.corner_location = CORNER_LOCATION_NONE; + } + wlr_scene_node_for_each_buffer(&c->scene_surface->node, scene_buffer_apply_effect, &data); }