Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
13 static unsigned int ltidx
= 0; /* default */
16 floating(void) { /* default floating layout */
19 for(c
= clients
; c
; c
= c
->next
)
21 resize(c
, c
->x
, c
->y
, c
->w
, c
->h
, True
);
24 static unsigned int nlayouts
= 0;
34 for(c
= clients
; c
; c
= c
->next
)
39 layouts
[ltidx
].arrange();
45 focusnext(const char *arg
) {
50 for(c
= sel
->next
; c
&& !isvisible(c
); c
= c
->next
);
52 for(c
= clients
; c
&& !isvisible(c
); c
= c
->next
);
60 focusprev(const char *arg
) {
65 for(c
= sel
->prev
; c
&& !isvisible(c
); c
= c
->prev
);
67 for(c
= clients
; c
&& c
->next
; c
= c
->next
);
68 for(; c
&& !isvisible(c
); c
= c
->prev
);
79 return layouts
[ltidx
].symbol
;
84 return layouts
[ltidx
].arrange
== floating
;
88 isarrange(void (*func
)())
90 return func
== layouts
[ltidx
].arrange
;
97 /* TODO deserialize ltidx if present */
98 nlayouts
= sizeof layouts
/ sizeof layouts
[0];
99 for(blw
= i
= 0; i
< nlayouts
; i
++) {
100 w
= textw(layouts
[i
].symbol
);
107 nexttiled(Client
*c
) {
108 for(; c
&& (c
->isfloating
|| !isvisible(c
)); c
= c
->next
);
121 if(sel
->isfloating
|| isfloating())
122 XRaiseWindow(dpy
, sel
->win
);
124 wc
.stack_mode
= Below
;
126 if(!sel
->isfloating
) {
127 XConfigureWindow(dpy
, sel
->win
, CWSibling
| CWStackMode
, &wc
);
128 wc
.sibling
= sel
->win
;
130 for(c
= nexttiled(clients
); c
; c
= nexttiled(c
->next
)) {
133 XConfigureWindow(dpy
, c
->win
, CWSibling
| CWStackMode
, &wc
);
138 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));
142 setlayout(const char *arg
) {
146 if(++ltidx
== nlayouts
)
151 if(i
< 0 || i
>= nlayouts
)
162 togglebar(const char *arg
) {
164 bpos
= (BARPOS
== BarOff
) ? BarTop
: BARPOS
;
172 togglemax(const char *arg
) {
175 if(!sel
|| (!isfloating() && !sel
->isfloating
) || sel
->isfixed
)
177 if((sel
->ismax
= !sel
->ismax
)) {
182 resize(sel
, wax
, way
, waw
- 2 * sel
->border
, wah
- 2 * sel
->border
, True
);
185 resize(sel
, sel
->rx
, sel
->ry
, sel
->rw
, sel
->rh
, True
);
187 while(XCheckMaskEvent(dpy
, EnterWindowMask
, &ev
));