Center floating windows when tiling
This commit is contained in:
parent
60e51c148d
commit
556c9b2fbc
2
config.h
2
config.h
@ -42,7 +42,7 @@ static const int resizehints = 0; /* 1 means respect size hints in tiled resi
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "t", tile }, /* first entry is default */
|
||||
{ "t", centerfloattile }, /* first entry is default */
|
||||
{ "f", NULL }, /* no layout function means floating behavior */
|
||||
{ "m", monocle },
|
||||
};
|
||||
|
@ -1,3 +1,15 @@
|
||||
void centerfloattile(Monitor *m) {
|
||||
if (!m->sel) return;
|
||||
|
||||
if (m->sel->isfloating && !m->sel->isfullscreen && !m->sel->isfixed && m->sel->x == 0 && m->sel->y == 0) {
|
||||
int x = (m->mw - m->sel->w) / 2;
|
||||
int y = (m->mh - m->sel->h) / 2;
|
||||
resize(m->sel, x, y, m->sel->w, m->sel->h, 0);
|
||||
}
|
||||
|
||||
tile(m);
|
||||
}
|
||||
|
||||
void togglefullscreen() {
|
||||
if (selmon->sel == 0) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user