aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-05-23 15:12:29 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-23 15:12:29 +0200
commitbde09805c13dbdf5811d5d0886ab1ac04f8a5f40 (patch)
treef098e2113b3f05ff633f4cf26ecf4456edb8c381
parent30b6cf449fdb84f0bc89d4db681164735c38767a (diff)
downloadgterm-bde09805c13dbdf5811d5d0886ab1ac04f8a5f40.tar.gz
add -cr option
-rw-r--r--gterm.113
-rw-r--r--gterm.c19
2 files changed, 27 insertions, 5 deletions
diff --git a/gterm.1 b/gterm.1
index fd779b6..55a415a 100644
--- a/gterm.1
+++ b/gterm.1
@@ -46,6 +46,19 @@ Config file key: title.
.TP
.BI -T " text"
Shortcut for -title.
+.TP
+.B -bc
+Enable cursor blinking.
+.br
+Config file key: cursorBlink.
+.TP
+.B +bc
+Disable cursor blinking.
+.TP
+.BI -cr " color"
+Set the cursor color
+.br
+Config file key: cursorColor.
\#
\#
.SH "CONFIG FILE"
diff --git a/gterm.c b/gterm.c
index 7246293..34eb045 100644
--- a/gterm.c
+++ b/gterm.c
@@ -23,6 +23,7 @@
#define GTERM_CFG_KEY_GEOMETRY "geometry"
#define GTERM_CFG_KEY_TITLE "title"
#define GTERM_CFG_KEY_CURSOR_BLINK "cursorBlink"
+#define GTERM_CFG_KEY_CURSOR_COLOR "cursorColor"
typedef struct gterm_opt {
char *opt;
@@ -37,11 +38,12 @@ typedef enum gterm_bool {
} gterm_bool;
static const gterm_opt gterm_opts[] = {
- { .opt = "fa", .key = GTERM_CFG_KEY_FONT_FACE },
- { .opt = "fs", .key = GTERM_CFG_KEY_FONT_SIZE },
- { .opt = "geometry", .key = GTERM_CFG_KEY_GEOMETRY },
- { .opt = "T", .key = GTERM_CFG_KEY_TITLE },
- { .opt = "title", .key = GTERM_CFG_KEY_TITLE },
+ { .opt = "fa", .key = GTERM_CFG_KEY_FONT_FACE },
+ { .opt = "fs", .key = GTERM_CFG_KEY_FONT_SIZE },
+ { .opt = "geometry", .key = GTERM_CFG_KEY_GEOMETRY },
+ { .opt = "T", .key = GTERM_CFG_KEY_TITLE },
+ { .opt = "title", .key = GTERM_CFG_KEY_TITLE },
+ { .opt = "cr", .key = GTERM_CFG_KEY_CURSOR_COLOR },
{ .opt = "bc", .key = GTERM_CFG_KEY_CURSOR_BLINK, .is_bool = true },
};
@@ -187,6 +189,7 @@ static void gterm_vte_configure(gterm *gt)
char *fontsize;
char *str;
gterm_bool b;
+ GdkRGBA color;
unsigned int cols, rows;
fontname = gterm_cfg_get(gt->cfg, GTERM_CFG_KEY_FONT_FACE);
@@ -220,6 +223,12 @@ static void gterm_vte_configure(gterm *gt)
vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(gt->terminal),
VTE_CURSOR_BLINK_OFF);
}
+
+ str = gterm_cfg_get(gt->cfg, GTERM_CFG_KEY_CURSOR_COLOR);
+ if (str) {
+ gdk_rgba_parse(&color, str);
+ vte_terminal_set_color_cursor(VTE_TERMINAL(gt->terminal), &color);
+ }
}
static void gterm_window_destroy(GtkWidget *widget, gpointer data)