Xinqi Bao's Git
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
10 #include <X11/Xutil.h>
23 void (*arrange
)(Arg
*) = DEFMODE
;
33 sel
->tags
[arg
->i
] = tags
[arg
->i
];
42 for(c
= clients
; c
; c
= c
->next
) {
45 resize(c
, True
, TopLeft
);
50 if(sel
&& !sel
->tags
[tsel
]) {
51 if((sel
= getnext(clients
))) {
56 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
68 for(n
= 0, c
= clients
; c
; c
= c
->next
)
69 if(c
->tags
[tsel
] && !c
->isfloat
)
73 h
= (sh
- bh
) / (n
- 1);
77 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
82 resize(c
, True
, TopLeft
);
99 c
->y
= sy
+ (i
- 1) * h
+ bh
;
103 else { /* fallback if h < bh */
109 resize(c
, False
, TopLeft
);
115 if(!sel
|| (sel
&& !sel
->tags
[tsel
])) {
116 if((sel
= getnext(clients
))) {
121 XSetInputFocus(dpy
, root
, RevertToPointerRoot
, CurrentTime
);
129 for(; c
&& !c
->tags
[tsel
]; c
= c
->next
);
136 for(; c
&& !c
->tags
[tsel
]; c
= c
->prev
);
148 for(i
= 0; i
< TLast
; i
++)
157 static unsigned int len
= sizeof(rule
) / sizeof(rule
[0]);
161 Bool matched
= False
;
164 if(XGetClassHint(dpy
, c
->win
, &ch
)) {
165 snprintf(classinst
, sizeof(classinst
), "%s:%s",
166 ch
.res_class
? ch
.res_class
: "",
167 ch
.res_name
? ch
.res_name
: "");
168 for(i
= 0; !matched
&& i
< len
; i
++) {
169 if(!regcomp(®ex
, rule
[i
].pattern
, 0)) {
170 if(!regexec(®ex
, classinst
, 1, &tmp
, 0)) {
171 for(j
= 0; j
< TLast
; j
++) {
174 c
->tags
[j
] = rule
[i
].tags
[j
];
176 c
->isfloat
= rule
[i
].isfloat
;
187 c
->tags
[tsel
] = tags
[tsel
];
193 arrange
= arrange
== dofloat
? dotile
: dofloat
;
208 arg
->i
= (tsel
< TLast
-1) ? tsel
+1 : 0;
215 arg
->i
= (tsel
> 0) ? tsel
-1 : TLast
-1;