aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-05-23 15:21:06 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-23 15:21:06 +0200
commit68c16b238fa604775c4ea315081af9ab9153b01d (patch)
treea2ede965fbdb189381ae145662e627b14ee64a63
parentbde09805c13dbdf5811d5d0886ab1ac04f8a5f40 (diff)
downloadgterm-68c16b238fa604775c4ea315081af9ab9153b01d.tar.gz
add -fg and -bg options
-rw-r--r--gterm.110
-rw-r--r--gterm.c14
2 files changed, 24 insertions, 0 deletions
diff --git a/gterm.1 b/gterm.1
index 55a415a..dc95947 100644
--- a/gterm.1
+++ b/gterm.1
@@ -59,6 +59,16 @@ Disable cursor blinking.
Set the cursor color
.br
Config file key: cursorColor.
+.TP
+.BI -fg " color"
+Set the foreground color
+.br
+Config file key: foreground.
+.TP
+.BI -fg " color"
+Set the background color
+.br
+Config file key: background.
\#
\#
.SH "CONFIG FILE"
diff --git a/gterm.c b/gterm.c
index 34eb045..f0e16cb 100644
--- a/gterm.c
+++ b/gterm.c
@@ -24,6 +24,8 @@
#define GTERM_CFG_KEY_TITLE "title"
#define GTERM_CFG_KEY_CURSOR_BLINK "cursorBlink"
#define GTERM_CFG_KEY_CURSOR_COLOR "cursorColor"
+#define GTERM_CFG_KEY_FOREGROUND "foreground"
+#define GTERM_CFG_KEY_BACKGROUND "background"
typedef struct gterm_opt {
char *opt;
@@ -44,6 +46,8 @@ static const gterm_opt gterm_opts[] = {
{ .opt = "T", .key = GTERM_CFG_KEY_TITLE },
{ .opt = "title", .key = GTERM_CFG_KEY_TITLE },
{ .opt = "cr", .key = GTERM_CFG_KEY_CURSOR_COLOR },
+ { .opt = "fg", .key = GTERM_CFG_KEY_FOREGROUND },
+ { .opt = "bg", .key = GTERM_CFG_KEY_BACKGROUND },
{ .opt = "bc", .key = GTERM_CFG_KEY_CURSOR_BLINK, .is_bool = true },
};
@@ -229,6 +233,16 @@ static void gterm_vte_configure(gterm *gt)
gdk_rgba_parse(&color, str);
vte_terminal_set_color_cursor(VTE_TERMINAL(gt->terminal), &color);
}
+ str = gterm_cfg_get(gt->cfg, GTERM_CFG_KEY_FOREGROUND);
+ if (str) {
+ gdk_rgba_parse(&color, str);
+ vte_terminal_set_color_foreground(VTE_TERMINAL(gt->terminal), &color);
+ }
+ str = gterm_cfg_get(gt->cfg, GTERM_CFG_KEY_BACKGROUND);
+ if (str) {
+ gdk_rgba_parse(&color, str);
+ vte_terminal_set_color_background(VTE_TERMINAL(gt->terminal), &color);
+ }
}
static void gterm_window_destroy(GtkWidget *widget, gpointer data)