aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gterm.110
-rw-r--r--gterm.c13
2 files changed, 23 insertions, 0 deletions
diff --git a/gterm.1 b/gterm.1
index dc95947..01e3887 100644
--- a/gterm.1
+++ b/gterm.1
@@ -69,6 +69,16 @@ Config file key: foreground.
Set the background color
.br
Config file key: background.
+.TP
+.BI -name " profile"
+Set profile. gterm will read settings from a [profile] section in the
+config file (if present). This mimics xterm's behavior of changing
+application name / application class when reading resources, so you
+could have different config sets in ~/.Xdefaults which are selected
+that way.
+.TP
+.BI -class " profile"
+Alias for -name.
\#
\#
.SH "CONFIG FILE"
diff --git a/gterm.c b/gterm.c
index f0e16cb..f1272f5 100644
--- a/gterm.c
+++ b/gterm.c
@@ -26,6 +26,7 @@
#define GTERM_CFG_KEY_CURSOR_COLOR "cursorColor"
#define GTERM_CFG_KEY_FOREGROUND "foreground"
#define GTERM_CFG_KEY_BACKGROUND "background"
+#define GTERM_CFG_KEY_PROFILE "profile"
typedef struct gterm_opt {
char *opt;
@@ -48,6 +49,8 @@ static const gterm_opt gterm_opts[] = {
{ .opt = "cr", .key = GTERM_CFG_KEY_CURSOR_COLOR },
{ .opt = "fg", .key = GTERM_CFG_KEY_FOREGROUND },
{ .opt = "bg", .key = GTERM_CFG_KEY_BACKGROUND },
+ { .opt = "name", .key = GTERM_CFG_KEY_PROFILE },
+ { .opt = "class", .key = GTERM_CFG_KEY_PROFILE },
{ .opt = "bc", .key = GTERM_CFG_KEY_CURSOR_BLINK, .is_bool = true },
};
@@ -79,12 +82,22 @@ static void gterm_cfg_set(GKeyFile *cfg, char *key, char *value)
static char *gterm_cfg_get(GKeyFile *cfg, char *key)
{
+ char *profile;
char *value;
+ profile = g_key_file_get_string(cfg, GTERM_CFG_GROUP_CMDLINE,
+ GTERM_CFG_KEY_PROFILE, NULL);
+
value = g_key_file_get_string(cfg, GTERM_CFG_GROUP_CMDLINE, key, NULL);
if (value)
return value;
+ if (profile) {
+ value = g_key_file_get_string(cfg, profile, key, NULL);
+ if (value)
+ return value;
+ }
+
value = g_key_file_get_string(cfg, GTERM_CFG_GROUP_DEFAULT, key, NULL);
if (value)
return value;