summaryrefslogtreecommitdiff
path: root/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/layout.c b/layout.c
index fe12e1e..a660fd7 100644
--- a/layout.c
+++ b/layout.c
@@ -2,11 +2,25 @@
#include "dwm.h"
#include <stdlib.h>
+typedef struct {
+ const char *symbol;
+ void (*arrange)(void);
+} Layout;
+
unsigned int blw = 0;
-Layout *lt = NULL;
+static Layout *lt = NULL;
/* static */
+static void
+floating(void) {
+ Client *c;
+
+ for(c = clients; c; c = c->next)
+ if(isvisible(c))
+ resize(c, c->x, c->y, c->w, c->h, True);
+}
+
static unsigned int nlayouts = 0;
LAYOUTS
@@ -14,19 +28,15 @@ LAYOUTS
/* extern */
void
-floating(void) {
+arrange(void) {
Client *c;
- if(lt->arrange != floating)
- return;
-
for(c = clients; c; c = c->next)
- if(isvisible(c)) {
+ if(isvisible(c))
unban(c);
- resize(c, c->x, c->y, c->w, c->h, True);
- }
else
ban(c);
+ lt->arrange();
focus(NULL);
restack();
}
@@ -55,6 +65,23 @@ focusclient(const char *arg) {
}
}
+const char *
+getsymbol(void)
+{
+ return lt->symbol;
+}
+
+Bool
+isfloating(void) {
+ return lt->arrange == floating;
+}
+
+Bool
+isarrange(void (*func)())
+{
+ return func == lt->arrange;
+}
+
void
initlayouts(void) {
unsigned int i, w;
@@ -119,7 +146,7 @@ setlayout(const char *arg) {
lt = &layout[i];
}
if(sel)
- lt->arrange();
+ arrange();
else
drawstatus();
}
@@ -131,7 +158,7 @@ togglebar(const char *arg) {
else
bpos = BarOff;
updatebarpos();
- lt->arrange();
+ arrange();
}
void