From a20849d45357dcbe58b510c8757c282e93f17554 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 7 Jun 2012 14:39:02 -0400 Subject: [PATCH] set cursor color from config --- config.h | 1 - termite.c | 10 ++++++++-- termite.cfg | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.h b/config.h index 9496652..8ab0005 100644 --- a/config.h +++ b/config.h @@ -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 diff --git a/termite.c b/termite.c index 3881f56..293cf0a 100644 --- a/termite.c +++ b/termite.c @@ -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); } diff --git a/termite.cfg b/termite.cfg index e729456..2dca298 100644 --- a/termite.cfg +++ b/termite.cfg @@ -17,3 +17,6 @@ cursor_blink = SYSTEM # BLOCK, UNDERLINE or IBEAM cursor_shape = BLOCK + +[colors] +cursor = #dcdccc