set cursor color from config

This commit is contained in:
Daniel Micay 2012-06-07 14:39:02 -04:00
parent c3c5bf131e
commit a20849d453
3 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,6 @@ static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
static const char *foreground_color = "#dcdccc";
static const char *background_color = "#3f3f3f";
static const char *cursor_color = "#dcdccc";
static const char *palette_s[16] = {
"#3f3f3f", // black

View File

@ -336,14 +336,20 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
gdk_color_parse(foreground_color, &colors->foreground);
gdk_color_parse(background_color, &colors->background);
gdk_color_parse(cursor_color, &colors->cursor);
for (unsigned i = 0; i < 16; i++) {
gdk_color_parse(palette_s[i], &colors->palette[i]);
}
vte_terminal_set_colors(vte, &colors->foreground, &colors->background, colors->palette, 16);
vte_terminal_set_color_cursor(vte, &colors->cursor);
gchar *cursor_color = g_key_file_get_string(config, "colors", "cursor", &error);
IGNORE_ON_ERROR(error) {
if (gdk_color_parse(cursor_color, &colors->cursor)) {
vte_terminal_set_color_cursor(vte, &colors->cursor);
}
g_free(cursor_color);
}
}
g_key_file_free(config);
}

View File

@ -17,3 +17,6 @@ cursor_blink = SYSTEM
# BLOCK, UNDERLINE or IBEAM
cursor_shape = BLOCK
[colors]
cursor = #dcdccc