Xinqi Bao's Git
3837fbdbde6d293e000e93fbfe536317038820c1
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", "Gecko", { [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
) {
51 if(sel
&& !sel
->tags
[tsel
]) {
52 if((sel
= getnext(clients
, tsel
))) {
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
) {
87 c
->w
= sw
- 2 * c
->border
;
88 c
->h
= sh
- 2 * c
->border
- bh
;
93 c
->w
= mw
- 2 * c
->border
;
94 c
->h
= sh
- 2 * c
->border
- bh
;
98 c
->y
= sy
+ (i
- 1) * h
+ bh
;
99 c
->w
= w
- 2 * c
->border
;
100 c
->h
= h
- 2 * c
->border
;
108 if(!sel
|| (sel
&& !sel
->tags
[tsel
])) {
109 if((sel
= getnext(clients
, tsel
))) {
118 getnext(Client
*c
, unsigned int t
)
120 for(; c
&& !c
->tags
[t
]; c
= c
->next
);
133 if(!(c
= getnext(clients
, arg
->i
)))
136 for(i
= 0; i
< TLast
; i
++)
138 c
->tags
[tsel
] = tags
[tsel
];
150 for(i
= 0; i
< TLast
; i
++)
159 static unsigned int len
= rule
? sizeof(rule
) / sizeof(rule
[0]) : 0;
161 Bool matched
= False
;
164 c
->tags
[tsel
] = tags
[tsel
];
168 if(XGetClassHint(dpy
, c
->win
, &ch
)) {
169 if(ch
.res_class
&& ch
.res_name
) {
170 for(i
= 0; i
< len
; i
++)
171 if(!strncmp(rule
[i
].class, ch
.res_class
, sizeof(rule
[i
].class))
172 && !strncmp(rule
[i
].instance
, ch
.res_name
, sizeof(rule
[i
].instance
)))
174 for(j
= 0; j
< TLast
; j
++)
175 c
->tags
[j
] = rule
[i
].tags
[j
];
176 c
->isfloat
= rule
[i
].isfloat
;
188 c
->tags
[tsel
] = tags
[tsel
];