diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-07-05 15:31:37 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-07-05 15:31:37 +0200 |
commit | 71960d285d047c73be334655b0ea2a6d32279948 (patch) | |
tree | 7951db67d38ed4107fee1abb2c5013dc9173771b | |
parent | 7c67952ba17625c12c00089424d55837a07f2d74 (diff) | |
download | gterm-71960d285d047c73be334655b0ea2a6d32279948.tar.gz |
gload: color option
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | gload.c | 11 |
2 files changed, 11 insertions, 2 deletions
@@ -20,7 +20,7 @@ not work with wayland. The x11 server side font rendering comes to mind for example. Also any charset quirks dating back to the early x11 days, before unicode and utf-8 did exist. -## gload +# gload Bundled with gterm is the small gload utility, which is a xload style load average monitor. @@ -18,12 +18,15 @@ #define GLOAD_CFG_KEY_LABEL "label" #define GLOAD_CFG_KEY_UPDATE "update" +#define GLOAD_CFG_KEY_HIGHLIGHT "highlight" static const gcfg_opt gload_opts[] = { { .opt = "label", .key = GLOAD_CFG_KEY_LABEL }, { .opt = "update", .key = GLOAD_CFG_KEY_UPDATE }, { .opt = "name", .key = GCFG_KEY_PROFILE }, { .opt = "class", .key = GCFG_KEY_PROFILE }, + { .opt = "hl", .key = GLOAD_CFG_KEY_HIGHLIGHT }, + { .opt = "highlight", .key = GLOAD_CFG_KEY_HIGHLIGHT }, }; /* ------------------------------------------------------------------------ */ @@ -124,13 +127,19 @@ static gboolean gload_draw(GtkWidget *widget, cairo_t *cr, gpointer data) gload *gl = data; GtkStyleContext *context; GdkRGBA normal, dimmed; + const char *highlight; guint width, height, i, idx, max; context = gtk_widget_get_style_context(widget); width = gtk_widget_get_allocated_width(widget); height = gtk_widget_get_allocated_height(widget); - gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &normal); + highlight = gcfg_get(gl->cfg, GLOAD_CFG_KEY_HIGHLIGHT); + if (highlight) { + gdk_rgba_parse(&normal, highlight); + } else { + gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &normal); + } dimmed = normal; normal.alpha = 1.0; dimmed.alpha = 0.6; |