fix&feat: fixed scratchpads tilling when they shouldnt, create a new canvas_notile windowrule so the user can define if a certain window should be tiled, also added canvas_pan_on_kill to disable the pan to next focused window when focused window is killed

This commit is contained in:
ernestoCruz05 2026-03-31 23:08:10 +01:00
parent 601b8cffcf
commit 179ae4995c
3 changed files with 14 additions and 2 deletions

View file

@ -95,6 +95,7 @@ typedef struct {
int32_t force_tearing;
int32_t noswallow;
int32_t noblur;
int32_t canvas_notile;
float focused_opacity;
float unfocused_opacity;
float scroller_proportion_single;
@ -316,6 +317,7 @@ typedef struct {
uint32_t borderpx;
int32_t canvas_tiling;
int32_t canvas_tiling_gap;
int32_t canvas_pan_on_kill;
float scratchpad_width_ratio;
float scratchpad_height_ratio;
float rootcolor[4];
@ -1719,6 +1721,8 @@ bool parse_option(Config *config, char *key, char *value) {
config->canvas_tiling = atoi(value);
} else if (strcmp(key, "canvas_tiling_gap") == 0) {
config->canvas_tiling_gap = atoi(value);
} else if (strcmp(key, "canvas_pan_on_kill") == 0) {
config->canvas_pan_on_kill = atoi(value);
} else if (strcmp(key, "rootcolor") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
@ -2091,6 +2095,7 @@ bool parse_option(Config *config, char *key, char *value) {
rule->force_tearing = -1;
rule->noswallow = -1;
rule->noblur = -1;
rule->canvas_notile = -1;
rule->nofocus = -1;
rule->nofadein = -1;
rule->nofadeout = -1;
@ -2210,6 +2215,8 @@ bool parse_option(Config *config, char *key, char *value) {
rule->noswallow = atoi(val);
} else if (strcmp(key, "noblur") == 0) {
rule->noblur = atoi(val);
} else if (strcmp(key, "canvas_notile") == 0) {
rule->canvas_notile = atoi(val);
} else if (strcmp(key, "scroller_proportion") == 0) {
rule->scroller_proportion = atof(val);
} else if (strcmp(key, "isfullscreen") == 0) {
@ -3360,6 +3367,7 @@ void set_value_default() {
config.borderpx = 4;
config.canvas_tiling = 0;
config.canvas_tiling_gap = 10;
config.canvas_pan_on_kill = 1;
config.overviewgappi = 5;
config.overviewgappo = 30;
config.cursor_hide_timeout = 0;

View file

@ -55,7 +55,8 @@ static void canvas_geom_init(Client *c, Monitor *m, uint32_t tag, float pan_x,
int tiling = config.canvas_tiling;
if (tiling > 0 && !client_is_float_type(c) && !client_get_parent(c)) {
if (tiling > 0 && !client_is_float_type(c) && !client_get_parent(c) &&
!c->is_in_scratchpad && !c->isnamedscratchpad && !c->canvas_notile) {
Client *focused = NULL, *tmp;
wl_list_for_each(tmp, &fstack, flink) {
if (tmp == c || tmp->iskilling || tmp->isunglobal)

View file

@ -412,6 +412,7 @@ struct Client {
float unfocused_opacity;
char oldmonname[128];
int32_t noblur;
int32_t canvas_notile;
double master_mfact_per, master_inner_per, stack_inner_per;
double old_master_mfact_per, old_master_inner_per, old_stack_inner_per;
double old_scroller_pproportion;
@ -1443,6 +1444,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
APPLY_INT_PROP(c, r, indleinhibit_when_focus);
APPLY_INT_PROP(c, r, isunglobal);
APPLY_INT_PROP(c, r, noblur);
APPLY_INT_PROP(c, r, canvas_notile);
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
APPLY_FLOAT_PROP(c, r, scroller_proportion);
@ -4273,6 +4275,7 @@ void init_client_properties(Client *c) {
c->noswallow = 0;
c->isterm = 0;
c->noblur = 0;
c->canvas_notile = 0;
c->tearing_hint = 0;
c->overview_isfullscreenbak = 0;
c->overview_ismaximizescreenbak = 0;
@ -6965,7 +6968,7 @@ void unmapnotify(struct wl_listener *listener, void *data) {
if (nextfocus) {
focusclient(nextfocus, 0);
if (selmon && is_canvas_layout(selmon))
if (config.canvas_pan_on_kill && selmon && is_canvas_layout(selmon))
canvas_pan_to_client(selmon, nextfocus);
}