port fernando’s custom background color patch
This commit is contained in:
parent
53b98fdc7e
commit
4cd6dd0303
|
@ -112,6 +112,7 @@ struct Config {
|
||||||
|
|
||||||
/* Color codes are stored here */
|
/* Color codes are stored here */
|
||||||
struct config_client {
|
struct config_client {
|
||||||
|
uint32_t background;
|
||||||
struct Colortriple focused;
|
struct Colortriple focused;
|
||||||
struct Colortriple focused_inactive;
|
struct Colortriple focused_inactive;
|
||||||
struct Colortriple unfocused;
|
struct Colortriple unfocused;
|
||||||
|
|
|
@ -102,6 +102,7 @@ stack-limit { return TOKSTACKLIMIT; }
|
||||||
cols { /* yylval.number = STACK_LIMIT_COLS; */return TOKSTACKLIMIT; }
|
cols { /* yylval.number = STACK_LIMIT_COLS; */return TOKSTACKLIMIT; }
|
||||||
rows { /* yylval.number = STACK_LIMIT_ROWS; */return TOKSTACKLIMIT; }
|
rows { /* yylval.number = STACK_LIMIT_ROWS; */return TOKSTACKLIMIT; }
|
||||||
exec { BEGIN(BIND_AWS_COND); return TOKEXEC; }
|
exec { BEGIN(BIND_AWS_COND); return TOKEXEC; }
|
||||||
|
client.background { BEGIN(COLOR_COND); yylval.single_color = &config.client.background; return TOKSINGLECOLOR; }
|
||||||
client.focused { BEGIN(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; }
|
client.focused { BEGIN(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; }
|
||||||
client.focused_inactive { BEGIN(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; }
|
client.focused_inactive { BEGIN(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; }
|
||||||
client.unfocused { BEGIN(COLOR_COND); yylval.color = &config.client.unfocused; return TOKCOLOR; }
|
client.unfocused { BEGIN(COLOR_COND); yylval.color = &config.client.unfocused; return TOKCOLOR; }
|
||||||
|
|
|
@ -182,6 +182,7 @@ void parse_file(const char *f) {
|
||||||
%union {
|
%union {
|
||||||
int number;
|
int number;
|
||||||
char *string;
|
char *string;
|
||||||
|
uint32_t *single_color;
|
||||||
struct Colortriple *color;
|
struct Colortriple *color;
|
||||||
struct Assignment *assignment;
|
struct Assignment *assignment;
|
||||||
struct Binding *binding;
|
struct Binding *binding;
|
||||||
|
@ -210,6 +211,7 @@ void parse_file(const char *f) {
|
||||||
%token TOKSET
|
%token TOKSET
|
||||||
%token TOKIPCSOCKET "ipc_socket"
|
%token TOKIPCSOCKET "ipc_socket"
|
||||||
%token TOKEXEC "exec"
|
%token TOKEXEC "exec"
|
||||||
|
%token TOKSINGLECOLOR
|
||||||
%token TOKCOLOR
|
%token TOKCOLOR
|
||||||
%token TOKARROW "→"
|
%token TOKARROW "→"
|
||||||
%token TOKMODE "mode"
|
%token TOKMODE "mode"
|
||||||
|
@ -240,6 +242,7 @@ line:
|
||||||
| assign
|
| assign
|
||||||
| ipcsocket
|
| ipcsocket
|
||||||
| exec
|
| exec
|
||||||
|
| single_color
|
||||||
| color
|
| color
|
||||||
| terminal
|
| terminal
|
||||||
| font
|
| font
|
||||||
|
@ -569,6 +572,13 @@ font:
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
single_color:
|
||||||
|
TOKSINGLECOLOR WHITESPACE colorpixel
|
||||||
|
{
|
||||||
|
uint32_t *dest = $<single_color>1;
|
||||||
|
*dest = $<number>3;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
color:
|
color:
|
||||||
TOKCOLOR WHITESPACE colorpixel WHITESPACE colorpixel WHITESPACE colorpixel
|
TOKCOLOR WHITESPACE colorpixel WHITESPACE colorpixel WHITESPACE colorpixel
|
||||||
|
|
|
@ -41,14 +41,17 @@ Con *con_new(Con *parent) {
|
||||||
/* TODO: remove window coloring after test-phase */
|
/* TODO: remove window coloring after test-phase */
|
||||||
LOG("color %s\n", colors[cnt]);
|
LOG("color %s\n", colors[cnt]);
|
||||||
new->name = strdup(colors[cnt]);
|
new->name = strdup(colors[cnt]);
|
||||||
|
#if 0
|
||||||
uint32_t cp = get_colorpixel(colors[cnt]);
|
uint32_t cp = get_colorpixel(colors[cnt]);
|
||||||
cnt++;
|
cnt++;
|
||||||
if ((cnt % (sizeof(colors) / sizeof(char*))) == 0)
|
if ((cnt % (sizeof(colors) / sizeof(char*))) == 0)
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
x_con_init(new);
|
x_con_init(new);
|
||||||
|
|
||||||
xcb_change_window_attributes(conn, new->frame, XCB_CW_BACK_PIXEL, &cp);
|
// TODO: this needs to be integrated into src/x.c and updated on config file reloads
|
||||||
|
xcb_change_window_attributes(conn, new->frame, XCB_CW_BACK_PIXEL, &config.client.background);
|
||||||
|
|
||||||
TAILQ_INIT(&(new->floating_head));
|
TAILQ_INIT(&(new->floating_head));
|
||||||
TAILQ_INIT(&(new->nodes_head));
|
TAILQ_INIT(&(new->nodes_head));
|
||||||
|
|
|
@ -348,6 +348,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
|
||||||
x.text = get_colorpixel(ctext); \
|
x.text = get_colorpixel(ctext); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
config.client.background = get_colorpixel("#000000");
|
||||||
INIT_COLOR(config.client.focused, "#4c7899", "#285577", "#ffffff");
|
INIT_COLOR(config.client.focused, "#4c7899", "#285577", "#ffffff");
|
||||||
INIT_COLOR(config.client.focused_inactive, "#333333", "#5f676a", "#ffffff");
|
INIT_COLOR(config.client.focused_inactive, "#333333", "#5f676a", "#ffffff");
|
||||||
INIT_COLOR(config.client.unfocused, "#333333", "#222222", "#888888");
|
INIT_COLOR(config.client.unfocused, "#333333", "#222222", "#888888");
|
||||||
|
|
Loading…
Reference in New Issue