mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Use section for titlebar parameters
This commit is contained in:
parent
ece6ffb8fe
commit
cc56ccd2e9
5 changed files with 51 additions and 19 deletions
|
@ -45,7 +45,7 @@ general
|
||||||
General is a section containing some general options for this screen.
|
General is a section containing some general options for this screen.
|
||||||
|
|
||||||
titlebar::
|
titlebar::
|
||||||
This option defines the position of window titlebar.
|
This section defines the parameters of the windows titlebar.
|
||||||
border::
|
border::
|
||||||
This defines the window borders size in pixel.
|
This defines the window borders size in pixel.
|
||||||
font::
|
font::
|
||||||
|
@ -537,10 +537,13 @@ Note: when there is no whitespace, quotes are optional.
|
||||||
<string> -> "foo bar"
|
<string> -> "foo bar"
|
||||||
<uicb-arg> -> prog, 3... (argument to a uicb function, where required)
|
<uicb-arg> -> prog, 3... (argument to a uicb function, where required)
|
||||||
<uicb-cmd> -> spawn, exec, client_tag... (see UICB FUNCTIONS above)
|
<uicb-cmd> -> spawn, exec, client_tag... (see UICB FUNCTIONS above)
|
||||||
|
<position> -> list of position: off, top, right, left, bottom, auto
|
||||||
<{.., ...}> -> list of available options
|
<{.., ...}> -> list of available options
|
||||||
<style section> -> a section with font, fg, bg, border, shadow and shadow_offset options.
|
<style section> -> a section with font, fg, bg, border, shadow and shadow_offset options.
|
||||||
{ font = <font> fg = <color> bg = <color> border = <color>
|
{ font = <font> fg = <color> bg = <color> border = <color>
|
||||||
shadow = <color> shadow_offset = <integer> }
|
shadow = <color> shadow_offset = <integer> }
|
||||||
|
<titlebar> -> a section with position and icon position.
|
||||||
|
{ position = <position> icon = <position> }
|
||||||
|
|
||||||
[MULTI] means, you can use an item multiple times.
|
[MULTI] means, you can use an item multiple times.
|
||||||
|
|
||||||
|
@ -562,6 +565,10 @@ screen <integer> [MULTI]
|
||||||
mwfact_lower_limit = <float>
|
mwfact_lower_limit = <float>
|
||||||
mwfact_upper_limit = <float>
|
mwfact_upper_limit = <float>
|
||||||
}
|
}
|
||||||
|
titlebar
|
||||||
|
{
|
||||||
|
<titlebar>
|
||||||
|
}
|
||||||
tags
|
tags
|
||||||
{
|
{
|
||||||
tag <identifier> [MULTI]
|
tag <identifier> [MULTI]
|
||||||
|
@ -594,7 +601,7 @@ screen <integer> [MULTI]
|
||||||
}
|
}
|
||||||
statusbar <identifier> [MULTI]
|
statusbar <identifier> [MULTI]
|
||||||
{
|
{
|
||||||
position = <{top,bottom,left,right}>
|
position = <{top,bottom,left,right,off}>
|
||||||
height = <integer>
|
height = <integer>
|
||||||
width = <integer>
|
width = <integer>
|
||||||
|
|
||||||
|
@ -728,6 +735,10 @@ rules
|
||||||
screen = <integer>
|
screen = <integer>
|
||||||
icon = <image>
|
icon = <image>
|
||||||
opacity = <float>
|
opacity = <float>
|
||||||
|
titlebar
|
||||||
|
{
|
||||||
|
<titlebar>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keys
|
keys
|
||||||
|
|
6
client.c
6
client.c
|
@ -358,7 +358,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
ewmh_check_client_hints(c);
|
ewmh_check_client_hints(c);
|
||||||
|
|
||||||
/* default titlebar position */
|
/* default titlebar position */
|
||||||
c->titlebar.position = globalconf.screens[screen].titlebar_default_position;
|
c->titlebar.position = globalconf.screens[screen].titlebar_default.position;
|
||||||
|
|
||||||
/* First check clients hints */
|
/* First check clients hints */
|
||||||
ewmh_check_client_hints(c);
|
ewmh_check_client_hints(c);
|
||||||
|
@ -393,8 +393,8 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
if(rule->opacity >= 0.0f)
|
if(rule->opacity >= 0.0f)
|
||||||
window_settrans(c->win, rule->opacity);
|
window_settrans(c->win, rule->opacity);
|
||||||
|
|
||||||
if(rule->titlebar != Auto)
|
if(rule->titlebar.position != Auto)
|
||||||
c->titlebar.position = rule->titlebar;
|
c->titlebar.position = rule->titlebar.position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
move_client_to_screen(c, screen, True);
|
move_client_to_screen(c, screen, True);
|
||||||
|
|
|
@ -67,10 +67,15 @@ cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt,
|
||||||
return cfg_include(cfg, opt, argc, argv);
|
return cfg_include(cfg, opt, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg_opt_t titlebar_opts[] =
|
||||||
|
{
|
||||||
|
CFG_STR((char *) "position", (char *) "off", CFGF_NONE),
|
||||||
|
CFG_STR((char *) "icon", (char *) "left", CFGF_NONE),
|
||||||
|
CFG_AWESOME_END()
|
||||||
|
};
|
||||||
cfg_opt_t general_opts[] =
|
cfg_opt_t general_opts[] =
|
||||||
{
|
{
|
||||||
CFG_INT((char *) "border", 1, CFGF_NONE),
|
CFG_INT((char *) "border", 1, CFGF_NONE),
|
||||||
CFG_STR((char *) "titlebar", (char *) "off", CFGF_NONE),
|
|
||||||
CFG_INT((char *) "snap", 8, CFGF_NONE),
|
CFG_INT((char *) "snap", 8, CFGF_NONE),
|
||||||
CFG_BOOL((char *) "resize_hints", cfg_true, CFGF_NONE),
|
CFG_BOOL((char *) "resize_hints", cfg_true, CFGF_NONE),
|
||||||
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
|
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
|
||||||
|
@ -264,6 +269,7 @@ cfg_opt_t padding_opts[] =
|
||||||
cfg_opt_t screen_opts[] =
|
cfg_opt_t screen_opts[] =
|
||||||
{
|
{
|
||||||
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
|
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
|
||||||
|
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
||||||
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
||||||
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
|
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
|
||||||
CFG_SEC((char *) "styles", styles_opts, CFGF_NONE),
|
CFG_SEC((char *) "styles", styles_opts, CFGF_NONE),
|
||||||
|
@ -280,7 +286,7 @@ cfg_opt_t rule_opts[] =
|
||||||
CFG_STR((char *) "icon", NULL, CFGF_NONE),
|
CFG_STR((char *) "icon", NULL, CFGF_NONE),
|
||||||
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
|
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
|
||||||
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
||||||
CFG_STR((char *) "titlebar", (char *) "auto", CFGF_NONE),
|
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
||||||
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
||||||
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
|
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
|
||||||
CFG_AWESOME_END()
|
CFG_AWESOME_END()
|
||||||
|
|
20
config.c
20
config.c
|
@ -272,6 +272,18 @@ create_widgets(cfg_t* cfg_statusbar, Statusbar *statusbar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb)
|
||||||
|
{
|
||||||
|
if(cfg_titlebar)
|
||||||
|
{
|
||||||
|
tb->position = position_get_from_str(cfg_getstr(cfg_titlebar, "position"));
|
||||||
|
tb->icon = position_get_from_str(cfg_getstr(cfg_titlebar, "icon"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tb->position = Auto;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_parse_screen(cfg_t *cfg, int screen)
|
config_parse_screen(cfg_t *cfg, int screen)
|
||||||
{
|
{
|
||||||
|
@ -282,7 +294,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
||||||
Tag *tag = NULL;
|
Tag *tag = NULL;
|
||||||
Statusbar *statusbar = NULL;
|
Statusbar *statusbar = NULL;
|
||||||
cfg_t *cfg_general, *cfg_styles, *cfg_screen, *cfg_tags,
|
cfg_t *cfg_general, *cfg_styles, *cfg_screen, *cfg_tags,
|
||||||
*cfg_layouts, *cfg_padding, *cfgsectmp,
|
*cfg_layouts, *cfg_padding, *cfgsectmp, *cfg_titlebar,
|
||||||
*cfg_styles_normal, *cfg_styles_focus, *cfg_styles_urgent;
|
*cfg_styles_normal, *cfg_styles_focus, *cfg_styles_urgent;
|
||||||
VirtScreen *virtscreen = &globalconf.screens[screen];
|
VirtScreen *virtscreen = &globalconf.screens[screen];
|
||||||
int i, phys_screen = get_phys_screen(screen);
|
int i, phys_screen = get_phys_screen(screen);
|
||||||
|
@ -303,6 +315,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
||||||
cfg_tags = cfg_getsec(cfg_screen, "tags");
|
cfg_tags = cfg_getsec(cfg_screen, "tags");
|
||||||
cfg_styles = cfg_getsec(cfg_screen, "styles");
|
cfg_styles = cfg_getsec(cfg_screen, "styles");
|
||||||
cfg_general = cfg_getsec(cfg_screen, "general");
|
cfg_general = cfg_getsec(cfg_screen, "general");
|
||||||
|
cfg_titlebar = cfg_getsec(cfg_screen, "titlebar");
|
||||||
cfg_layouts = cfg_getsec(cfg_screen, "layouts");
|
cfg_layouts = cfg_getsec(cfg_screen, "layouts");
|
||||||
cfg_padding = cfg_getsec(cfg_screen, "padding");
|
cfg_padding = cfg_getsec(cfg_screen, "padding");
|
||||||
|
|
||||||
|
@ -319,8 +332,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
||||||
virtscreen->floating_placement =
|
virtscreen->floating_placement =
|
||||||
name_func_lookup(cfg_getstr(cfg_general, "floating_placement"),
|
name_func_lookup(cfg_getstr(cfg_general, "floating_placement"),
|
||||||
FloatingPlacementList);
|
FloatingPlacementList);
|
||||||
virtscreen->titlebar_default_position =
|
config_section_titlebar_init(cfg_titlebar, &virtscreen->titlebar_default);
|
||||||
position_get_from_str(cfg_getstr(cfg_general, "titlebar"));
|
|
||||||
|
|
||||||
virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit");
|
virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit");
|
||||||
virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit");
|
virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit");
|
||||||
|
@ -526,8 +538,8 @@ config_parse(const char *confpatharg)
|
||||||
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
|
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||||
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
|
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
|
||||||
rule->titlebar = position_get_from_str(cfg_getstr(cfgsectmp, "titlebar"));
|
|
||||||
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
|
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
|
||||||
|
config_section_titlebar_init(cfg_getsec(cfgsectmp, "titlebar"), &rule->titlebar);
|
||||||
if(rule->screen >= globalconf.screens_info->nscreen)
|
if(rule->screen >= globalconf.screens_info->nscreen)
|
||||||
rule->screen = 0;
|
rule->screen = 0;
|
||||||
|
|
||||||
|
|
19
structs.h
19
structs.h
|
@ -40,6 +40,13 @@ typedef enum
|
||||||
enum
|
enum
|
||||||
{ CurNormal, CurResize, CurMove, CurLast };
|
{ CurNormal, CurResize, CurMove, CurLast };
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SimpleWindow *sw;
|
||||||
|
Position position;
|
||||||
|
Position icon;
|
||||||
|
} Titlebar;
|
||||||
|
|
||||||
/** Rule type */
|
/** Rule type */
|
||||||
typedef struct Rule Rule;
|
typedef struct Rule Rule;
|
||||||
struct Rule
|
struct Rule
|
||||||
|
@ -49,7 +56,7 @@ struct Rule
|
||||||
int screen;
|
int screen;
|
||||||
Fuzzy isfloating;
|
Fuzzy isfloating;
|
||||||
Fuzzy ismaster;
|
Fuzzy ismaster;
|
||||||
Position titlebar;
|
Titlebar titlebar;
|
||||||
double opacity;
|
double opacity;
|
||||||
regex_t *prop_r;
|
regex_t *prop_r;
|
||||||
regex_t *tags_r;
|
regex_t *tags_r;
|
||||||
|
@ -192,11 +199,7 @@ struct Client
|
||||||
/** True if the client is a new one */
|
/** True if the client is a new one */
|
||||||
Bool newcomer;
|
Bool newcomer;
|
||||||
/** Titlebar */
|
/** Titlebar */
|
||||||
struct
|
Titlebar titlebar;
|
||||||
{
|
|
||||||
SimpleWindow *sw;
|
|
||||||
Position position;
|
|
||||||
} titlebar;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct client_node_t client_node_t;
|
typedef struct client_node_t client_node_t;
|
||||||
|
@ -257,8 +260,8 @@ typedef struct
|
||||||
typedef area_t (FloatingPlacement)(area_t, int, int);
|
typedef area_t (FloatingPlacement)(area_t, int, int);
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/** Titlebar position */
|
/** Titlebar default parameters */
|
||||||
Position titlebar_default_position;
|
Titlebar titlebar_default;
|
||||||
/** Number of pixels to snap windows */
|
/** Number of pixels to snap windows */
|
||||||
int snap;
|
int snap;
|
||||||
/** Border size */
|
/** Border size */
|
||||||
|
|
Loading…
Reference in a new issue