#include <stdlib.h>
#include "util.h"
+#include "conf.h"
#include "sys.h"
#include "wm.h"
+/* Configuration */
#ifndef MODKEY
#define MODKEY alt
#endif
-#ifndef MARGIN
-#define MARGIN 0
-#endif
-#ifndef STACK
-#define STACK 25
-#endif
+static int MARGIN = 0;
+static int STACK = 25;
/* Enums */
typedef enum {
printf("tag_switch: %d\n", name);
tag_t *old = wm_tag;
if ((wm_col == NULL || wm_row == NULL) && wm_flt == NULL) {
- list_t *ltag = list_find(wm->tags, old);
- wm->tags = list_remove(wm->tags, ltag, 1);
while (old->dpys) {
dpy_t *dpy = old->dpys->data;
while (dpy->cols)
dpy->cols = list_remove(dpy->cols, dpy->cols, 1);
old->dpys = list_remove(old->dpys, old->dpys, 1);
}
- free(old);
+ list_t *ltag = list_find(wm->tags, old);
+ wm->tags = list_remove(wm->tags, ltag, 1);
}
wm_tag = tag_find(name);
}
if (move_mode != none && mod.up)
return set_move(win,ptr,none), 1;
if (key == key_mouse1 && !mod.up && win->h == STACK)
- return wm_update(), 0;
+ return set_focus(win), wm_update(), 0;
return 0;
}
}
/* Focus change */
- if (key == key_enter)
+ if (key == key_enter && win->h != STACK)
return set_focus(win), 1;
if (key_mouse0 <= key && key <= key_mouse7)
{
printf("wm_init: %p\n", root);
+ /* Load configuration */
+ MARGIN = conf_get_int("main.margin", MARGIN);
+ STACK = conf_get_int("main.stack", STACK);
+
/* Hack, fix screen order */
list_t *screens = sys_info(root);
list_t *left = screens;