Xinqi Bao's Git
c9eec90233b41d417cb1f0dfed1ef4d0120aeb99
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
13 static Rule rule
[] = {
14 /* class instance tags isfloat */
15 { "Firefox-bin", "firefox-bin", { [Twww
] = "www" }, False
},
22 [Tscratch
] = "scratch",
27 void (*arrange
)(Arg
*) = dotile
;
35 sel
->tags
[arg
->i
] = tags
[arg
->i
];
45 for(c
= clients
; c
; c
= c
->next
) {
48 resize(c
, True
, TopLeft
);
53 if(sel
&& !sel
->tags
[tsel
]) {
54 if((sel
= getnext(clients
, tsel
))) {
70 for(n
= 0, c
= clients
; c
; c
= c
->next
)
71 if(c
->tags
[tsel
] && !c
->isfloat
)
75 h
= (sh
- bh
) / (n
- 1);
79 for(i
= 0, c
= clients
; c
; c
= c
->next
) {
84 resize(c
, True
, TopLeft
);
90 *c
->w
= sw
- 2 * c
->border
;
91 *c
->h
= sh
- 2 * c
->border
- bh
;
96 *c
->w
= mw
- 2 * c
->border
;
97 *c
->h
= sh
- 2 * c
->border
- bh
;
101 *c
->y
= sy
+ (i
- 1) * h
+ bh
;
102 *c
->w
= w
- 2 * c
->border
;
103 *c
->h
= h
- 2 * c
->border
;
105 else { /* fallback if h < bh */
108 *c
->w
= w
- 2 * c
->border
;
109 *c
->h
= sh
- 2 * c
->border
- bh
;
111 resize(c
, False
, TopLeft
);
117 if(!sel
|| (sel
&& !sel
->tags
[tsel
])) {
118 if((sel
= getnext(clients
, tsel
))) {
127 getnext(Client
*c
, unsigned int t
)
129 for(; c
&& !c
->tags
[t
]; c
= c
->next
);
142 if(!(c
= getnext(clients
, arg
->i
)))
145 for(i
= 0; i
< TLast
; i
++)
147 c
->tags
[tsel
] = tags
[tsel
];
159 for(i
= 0; i
< TLast
; i
++)
168 static unsigned int len
= rule
? sizeof(rule
) / sizeof(rule
[0]) : 0;
170 Bool matched
= False
;
173 c
->tags
[tsel
] = tags
[tsel
];
177 if(XGetClassHint(dpy
, c
->win
, &ch
)) {
178 if(ch
.res_class
&& ch
.res_name
) {
179 for(i
= 0; i
< len
; i
++)
180 if(!strncmp(rule
[i
].class, ch
.res_class
, sizeof(rule
[i
].class))
181 && !strncmp(rule
[i
].instance
, ch
.res_name
, sizeof(rule
[i
].instance
)))
183 for(j
= 0; j
< TLast
; j
++)
184 c
->tags
[j
] = rule
[i
].tags
[j
];
185 c
->isfloat
= rule
[i
].isfloat
;
197 c
->tags
[tsel
] = tags
[tsel
];