add taglayouts in jdwmconf as tag_layouts
This commit is contained in:
parent
9f9757e1b4
commit
274f1270e6
50
config.c
50
config.c
|
@ -153,6 +153,7 @@ uicb_reload(Display *disp, jdwm_config *jdwmconf, const char *arg __attribute__
|
||||||
p_delete(&jdwmconf->tags);
|
p_delete(&jdwmconf->tags);
|
||||||
p_delete(&jdwmconf->selected_tags);
|
p_delete(&jdwmconf->selected_tags);
|
||||||
p_delete(&jdwmconf->layouts);
|
p_delete(&jdwmconf->layouts);
|
||||||
|
p_delete(&jdwmconf->tag_layouts);
|
||||||
parse_config(disp, screen, &dc, jdwmconf);
|
parse_config(disp, screen, &dc, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,28 +193,6 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
|
||||||
eprint("error parsing configuration file at line %d: %s\n",
|
eprint("error parsing configuration file at line %d: %s\n",
|
||||||
config_error_line(&jdwmlibconf), config_error_text(&jdwmlibconf));
|
config_error_line(&jdwmlibconf), config_error_text(&jdwmlibconf));
|
||||||
|
|
||||||
/* tags */
|
|
||||||
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
|
|
||||||
|
|
||||||
if(!conftags)
|
|
||||||
eprint("tags not found in configuration file\n");
|
|
||||||
|
|
||||||
jdwmconf->ntags = config_setting_length(conftags);
|
|
||||||
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
|
|
||||||
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
|
|
||||||
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
|
|
||||||
|
|
||||||
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
|
|
||||||
{
|
|
||||||
jdwmconf->tags[i] = tmp;
|
|
||||||
jdwmconf->selected_tags[i] = False;
|
|
||||||
jdwmconf->prev_selected_tags[i] = False;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* select first tag by default */
|
|
||||||
jdwmconf->selected_tags[0] = True;
|
|
||||||
jdwmconf->prev_selected_tags[0] = True;
|
|
||||||
|
|
||||||
/* layouts */
|
/* layouts */
|
||||||
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");
|
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");
|
||||||
|
|
||||||
|
@ -228,13 +207,38 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
|
||||||
jdwmconf->layouts[i].arrange =
|
jdwmconf->layouts[i].arrange =
|
||||||
name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList);
|
name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList);
|
||||||
if(!jdwmconf->layouts[i].arrange)
|
if(!jdwmconf->layouts[i].arrange)
|
||||||
eprint("unknown layout in configuration file: %s", tmp);
|
eprint("unknown layout in configuration file\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
jdwmconf->layouts[i].symbol = NULL;
|
jdwmconf->layouts[i].symbol = NULL;
|
||||||
jdwmconf->layouts[i].arrange = NULL;
|
jdwmconf->layouts[i].arrange = NULL;
|
||||||
|
|
||||||
/** \todo put this in set_default_layout */
|
/** \todo put this in set_default_layout */
|
||||||
jdwmconf->current_layout = jdwmconf->layouts;
|
jdwmconf->current_layout = jdwmconf->layouts;
|
||||||
|
/* tags */
|
||||||
|
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
|
||||||
|
|
||||||
|
if(!conftags)
|
||||||
|
eprint("tags not found in configuration file\n");
|
||||||
|
|
||||||
|
jdwmconf->ntags = config_setting_length(conftags);
|
||||||
|
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
|
||||||
|
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
|
||||||
|
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
|
||||||
|
jdwmconf->tag_layouts = p_new(Layout *, jdwmconf->ntags);
|
||||||
|
|
||||||
|
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
|
||||||
|
{
|
||||||
|
jdwmconf->tags[i] = tmp;
|
||||||
|
jdwmconf->selected_tags[i] = False;
|
||||||
|
jdwmconf->prev_selected_tags[i] = False;
|
||||||
|
/** \todo add support for default tag/layout in configuration file */
|
||||||
|
jdwmconf->tag_layouts[i] = jdwmconf->layouts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* select first tag by default */
|
||||||
|
jdwmconf->selected_tags[0] = True;
|
||||||
|
jdwmconf->prev_selected_tags[0] = True;
|
||||||
|
|
||||||
/* rules */
|
/* rules */
|
||||||
confrules = config_lookup(&jdwmlibconf, "jdwm.rules");
|
confrules = config_lookup(&jdwmlibconf, "jdwm.rules");
|
||||||
|
|
2
config.h
2
config.h
|
@ -69,6 +69,8 @@ struct jdwm_config
|
||||||
Layout *layouts;
|
Layout *layouts;
|
||||||
/** Number of layouts in *layouts */
|
/** Number of layouts in *layouts */
|
||||||
int nlayouts;
|
int nlayouts;
|
||||||
|
/** Store layout for eatch tag */
|
||||||
|
Layout **tag_layouts;
|
||||||
/** Rules list */
|
/** Rules list */
|
||||||
Rule *rules;
|
Rule *rules;
|
||||||
/** Number of rules in *rules */
|
/** Number of rules in *rules */
|
||||||
|
|
2
jdwm.c
2
jdwm.c
|
@ -32,7 +32,6 @@ Client *stack = NULL;
|
||||||
Cursor cursor[CurLast];
|
Cursor cursor[CurLast];
|
||||||
DC dc;
|
DC dc;
|
||||||
Window barwin;
|
Window barwin;
|
||||||
Layout ** taglayouts;
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
|
||||||
XFreeCursor(disp, cursor[CurMove]);
|
XFreeCursor(disp, cursor[CurMove]);
|
||||||
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
p_delete(&taglayouts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
|
|
7
layout.c
7
layout.c
|
@ -18,7 +18,6 @@ int blw = 0;
|
||||||
static char prop[128];
|
static char prop[128];
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern Layout ** taglayouts;
|
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
extern int wax, way, wah, waw; /* windowarea geometry */
|
||||||
extern Window barwin;
|
extern Window barwin;
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
|
@ -92,10 +91,6 @@ initlayouts(jdwm_config * jdwmconf)
|
||||||
if(w > blw)
|
if(w > blw)
|
||||||
blw = w;
|
blw = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
taglayouts = p_new(Layout *, jdwmconf->ntags);
|
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
|
||||||
taglayouts[i] = jdwmconf->layouts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -192,7 +187,7 @@ uicb_setlayout(Display *disp, jdwm_config * jdwmconf, const char *arg)
|
||||||
|
|
||||||
for(j = 0; j < jdwmconf->ntags; j++)
|
for(j = 0; j < jdwmconf->ntags; j++)
|
||||||
if (jdwmconf->selected_tags[j])
|
if (jdwmconf->selected_tags[j])
|
||||||
taglayouts[j] = jdwmconf->current_layout;
|
jdwmconf->tag_layouts[j] = jdwmconf->current_layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
3
tag.c
3
tag.c
|
@ -10,7 +10,6 @@
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
extern Client *sel; /* global client list */
|
extern Client *sel; /* global client list */
|
||||||
extern Layout ** taglayouts;
|
|
||||||
|
|
||||||
static Regs *regs = NULL;
|
static Regs *regs = NULL;
|
||||||
static char prop[512];
|
static char prop[512];
|
||||||
|
@ -233,7 +232,7 @@ uicb_view(Display *disp,
|
||||||
if(i >= 0 && i < jdwmconf->ntags)
|
if(i >= 0 && i < jdwmconf->ntags)
|
||||||
{
|
{
|
||||||
jdwmconf->selected_tags[i] = True;
|
jdwmconf->selected_tags[i] = True;
|
||||||
jdwmconf->current_layout = taglayouts[i];
|
jdwmconf->current_layout = jdwmconf->tag_layouts[i];
|
||||||
}
|
}
|
||||||
savejdwmprops(disp, jdwmconf);
|
savejdwmprops(disp, jdwmconf);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, jdwmconf);
|
||||||
|
|
Loading…
Reference in New Issue