Adapted center first now works with Pertag.
This commit is contained in:
parent
4a8274e7b0
commit
409a9dfcfa
1
config.h
1
config.h
@ -63,6 +63,7 @@ static const Rule rules[] = {
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int centerfirst = 1; /* center first window if it has rule */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
|
13
dwm.c
13
dwm.c
@ -279,7 +279,6 @@ static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
static int isgaming = 0;
|
||||
static int centerfirst = 0;
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
@ -291,6 +290,7 @@ struct Pertag {
|
||||
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
int centerfirst[LENGTH(tags) + 1]; /* center first window */
|
||||
};
|
||||
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
@ -678,6 +678,8 @@ createmon(void)
|
||||
m->pertag->sellts[i] = m->sellt;
|
||||
|
||||
m->pertag->showbars[i] = m->showbar;
|
||||
|
||||
m->pertag->centerfirst[i] = centerfirst;
|
||||
}
|
||||
|
||||
return m;
|
||||
@ -1757,7 +1759,7 @@ tile(Monitor *m)
|
||||
return;
|
||||
|
||||
c = nexttiled(m->clients);
|
||||
if (n == 1 && centerfirst && c && c->iscentered){
|
||||
if (n == 1 && m->pertag->centerfirst[m->pertag->curtag] && c && c->iscentered){
|
||||
resize(
|
||||
c,
|
||||
m->wx + m->ww*(1 - m->mfact)/2,
|
||||
@ -2416,10 +2418,9 @@ togglegaming(const Arg* arg)
|
||||
void /* toggle center first window */
|
||||
togglecenterfirst(const Arg* arg)
|
||||
{
|
||||
centerfirst ^= 1;
|
||||
if (selmon->sel)
|
||||
if (!arg || !selmon->lt[selmon->sellt]->arrange)
|
||||
return;
|
||||
selmon->pertag->centerfirst[selmon->pertag->curtag] ^= 1;
|
||||
arrange(selmon);
|
||||
else
|
||||
drawbar(selmon);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user