equal
deleted
inserted
replaced
8 const char *symbol; |
8 const char *symbol; |
9 void (*arrange)(void); |
9 void (*arrange)(void); |
10 } Layout; |
10 } Layout; |
11 |
11 |
12 unsigned int blw = 0; |
12 unsigned int blw = 0; |
13 static unsigned int sellayout = 0; /* default */ |
13 static unsigned int ltidx = 0; /* default */ |
14 |
14 |
15 static void |
15 static void |
16 floating(void) { /* default floating layout */ |
16 floating(void) { /* default floating layout */ |
17 Client *c; |
17 Client *c; |
18 |
18 |
34 for(c = clients; c; c = c->next) |
34 for(c = clients; c; c = c->next) |
35 if(isvisible(c)) |
35 if(isvisible(c)) |
36 unban(c); |
36 unban(c); |
37 else |
37 else |
38 ban(c); |
38 ban(c); |
39 layouts[sellayout].arrange(); |
39 layouts[ltidx].arrange(); |
40 focus(NULL); |
40 focus(NULL); |
41 restack(); |
41 restack(); |
42 } |
42 } |
43 |
43 |
44 void |
44 void |
74 } |
74 } |
75 |
75 |
76 const char * |
76 const char * |
77 getsymbol(void) |
77 getsymbol(void) |
78 { |
78 { |
79 return layouts[sellayout].symbol; |
79 return layouts[ltidx].symbol; |
80 } |
80 } |
81 |
81 |
82 Bool |
82 Bool |
83 isfloating(void) { |
83 isfloating(void) { |
84 return layouts[sellayout].arrange == floating; |
84 return layouts[ltidx].arrange == floating; |
85 } |
85 } |
86 |
86 |
87 Bool |
87 Bool |
88 isarrange(void (*func)()) |
88 isarrange(void (*func)()) |
89 { |
89 { |
90 return func == layouts[sellayout].arrange; |
90 return func == layouts[ltidx].arrange; |
91 } |
91 } |
92 |
92 |
93 void |
93 void |
94 initlayouts(void) { |
94 initlayouts(void) { |
95 unsigned int i, w; |
95 unsigned int i, w; |
96 |
96 |
97 /* TODO deserialize sellayout if present */ |
97 /* TODO deserialize ltidx if present */ |
98 nlayouts = sizeof layouts / sizeof layouts[0]; |
98 nlayouts = sizeof layouts / sizeof layouts[0]; |
99 for(blw = i = 0; i < nlayouts; i++) { |
99 for(blw = i = 0; i < nlayouts; i++) { |
100 w = textw(layouts[i].symbol); |
100 w = textw(layouts[i].symbol); |
101 if(w > blw) |
101 if(w > blw) |
102 blw = w; |
102 blw = w; |
141 void |
141 void |
142 setlayout(const char *arg) { |
142 setlayout(const char *arg) { |
143 int i; |
143 int i; |
144 |
144 |
145 if(!arg) { |
145 if(!arg) { |
146 if(++sellayout == nlayouts) |
146 if(++ltidx == nlayouts) |
147 sellayout = 0;; |
147 ltidx = 0;; |
148 } |
148 } |
149 else { |
149 else { |
150 i = atoi(arg); |
150 i = atoi(arg); |
151 if(i < 0 || i >= nlayouts) |
151 if(i < 0 || i >= nlayouts) |
152 return; |
152 return; |
153 sellayout = i; |
153 ltidx = i; |
154 } |
154 } |
155 if(sel) |
155 if(sel) |
156 arrange(); |
156 arrange(); |
157 else |
157 else |
158 drawstatus(); |
158 drawstatus(); |