feat: winrule option no_force_center
This commit is contained in:
@@ -37,6 +37,7 @@ typedef struct {
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int nofadein;
|
int nofadein;
|
||||||
|
int no_force_center;
|
||||||
int isterm;
|
int isterm;
|
||||||
int noswallow;
|
int noswallow;
|
||||||
int scratchpad_width;
|
int scratchpad_width;
|
||||||
@@ -1101,6 +1102,7 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
rule->offsetx = 0;
|
rule->offsetx = 0;
|
||||||
rule->offsety = 0;
|
rule->offsety = 0;
|
||||||
rule->nofadein = 0;
|
rule->nofadein = 0;
|
||||||
|
rule->no_force_center = 0;
|
||||||
rule->scratchpad_width = 0;
|
rule->scratchpad_width = 0;
|
||||||
rule->scratchpad_height = 0;
|
rule->scratchpad_height = 0;
|
||||||
rule->width = 0;
|
rule->width = 0;
|
||||||
@@ -1144,7 +1146,9 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
rule->offsety = atoi(val);
|
rule->offsety = atoi(val);
|
||||||
} else if (strcmp(key, "nofadein") == 0) {
|
} else if (strcmp(key, "nofadein") == 0) {
|
||||||
rule->nofadein = atoi(val);
|
rule->nofadein = atoi(val);
|
||||||
} else if (strcmp(key, "scratchpad_width") == 0) {
|
} else if (strcmp(key, "no_force_center") == 0) {
|
||||||
|
rule->no_force_center = atoi(val);
|
||||||
|
} else if (strcmp(key, "scratchpad_width") == 0) {
|
||||||
rule->scratchpad_width = atoi(val);
|
rule->scratchpad_width = atoi(val);
|
||||||
} else if (strcmp(key, "scratchpad_height") == 0) {
|
} else if (strcmp(key, "scratchpad_height") == 0) {
|
||||||
rule->scratchpad_height = atoi(val);
|
rule->scratchpad_height = atoi(val);
|
||||||
|
|||||||
14
src/maomao.c
14
src/maomao.c
@@ -277,6 +277,7 @@ struct Client {
|
|||||||
bool drag_to_tile;
|
bool drag_to_tile;
|
||||||
bool fake_no_border;
|
bool fake_no_border;
|
||||||
int nofadein;
|
int nofadein;
|
||||||
|
int no_force_center;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -1742,8 +1743,14 @@ setclient_coordinate_center(Client *c, struct wlr_box geom, int offsetx,
|
|||||||
|
|
||||||
unsigned int cbw = check_hit_no_border(c) ? c->bw : 0;
|
unsigned int cbw = check_hit_no_border(c) ? c->bw : 0;
|
||||||
|
|
||||||
tempbox.x = selmon->w.x + (selmon->w.width - geom.width) / 2;
|
if(!c->no_force_center) {
|
||||||
tempbox.y = selmon->w.y + (selmon->w.height - geom.height) / 2;
|
tempbox.x = selmon->w.x + (selmon->w.width - geom.width) / 2;
|
||||||
|
tempbox.y = selmon->w.y + (selmon->w.height - geom.height) / 2;
|
||||||
|
} else {
|
||||||
|
tempbox.x = geom.x;
|
||||||
|
tempbox.y = geom.y;
|
||||||
|
}
|
||||||
|
|
||||||
tempbox.width = geom.width;
|
tempbox.width = geom.width;
|
||||||
tempbox.height = geom.height;
|
tempbox.height = geom.height;
|
||||||
|
|
||||||
@@ -1843,6 +1850,8 @@ applyrules(Client *c) {
|
|||||||
c->isterm = r->isterm > 0 ? r->isterm : c->isterm;
|
c->isterm = r->isterm > 0 ? r->isterm : c->isterm;
|
||||||
c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow;
|
c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow;
|
||||||
c->nofadein = r->nofadein > 0 ? r->nofadein : c->nofadein;
|
c->nofadein = r->nofadein > 0 ? r->nofadein : c->nofadein;
|
||||||
|
c->no_force_center = r->no_force_center > 0 ? r->no_force_center
|
||||||
|
: c->no_force_center;
|
||||||
c->scratchpad_geom.width = r->scratchpad_width > 0
|
c->scratchpad_geom.width = r->scratchpad_width > 0
|
||||||
? r->scratchpad_width
|
? r->scratchpad_width
|
||||||
: c->scratchpad_geom.width;
|
: c->scratchpad_geom.width;
|
||||||
@@ -4491,6 +4500,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
c->drag_to_tile = false;
|
c->drag_to_tile = false;
|
||||||
c->fake_no_border = false;
|
c->fake_no_border = false;
|
||||||
c->nofadein = 0;
|
c->nofadein = 0;
|
||||||
|
c->no_force_center = 0;
|
||||||
|
|
||||||
if (new_is_master && selmon &&
|
if (new_is_master && selmon &&
|
||||||
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
||||||
|
|||||||
Reference in New Issue
Block a user