From 0a85423759b5db0616e500c050371260742fcd47 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 9 Nov 2020 22:26:23 +0100 Subject: [PATCH] main: add --colorscheme --- man/terminology.1 | 5 +++++ src/bin/ipc.c | 2 ++ src/bin/ipc.h | 1 + src/bin/main.c | 16 ++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/man/terminology.1 b/man/terminology.1 index 1e2d943d..3662837a 100644 --- a/man/terminology.1 +++ b/man/terminology.1 @@ -167,6 +167,11 @@ Scaling factor to use on the UI. Type: DOUBLE. . .TP +.B \-\-colorscheme=COLORSCHEME +Use the named color scheme. +Type: STR. +. +.TP .B \-V, \-\-version Show program version. . diff --git a/src/bin/ipc.c b/src/bin/ipc.c index 83c16a30..6cad2b9f 100644 --- a/src/bin/ipc.c +++ b/src/bin/ipc.c @@ -104,6 +104,8 @@ ipc_init(void) "name", name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, "theme", theme, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, + "colorscheme", colorscheme, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, "role", role, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, diff --git a/src/bin/ipc.h b/src/bin/ipc.h index 26349b9c..852915dd 100644 --- a/src/bin/ipc.h +++ b/src/bin/ipc.h @@ -12,6 +12,7 @@ struct _Ipc_Instance char *background; char *name; char *theme; + char *colorscheme; char *role; char *title; char *icon_name; diff --git a/src/bin/main.c b/src/bin/main.c index 3e9fe7eb..149738fd 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -57,6 +57,13 @@ _configure_instance(Ipc_Instance *inst) _set_instance_theme(inst); + if (inst->colorscheme) + { + eina_stringshare_replace(&(config->color_scheme_name), inst->colorscheme); + config_compute_color_scheme(config); + config->temporary = EINA_TRUE; + } + if (inst->background) { eina_stringshare_replace(&(config->background), inst->background); @@ -221,6 +228,7 @@ main_ipc_new(Ipc_Instance *inst) if (inst->visual_bell) nargc += 1; if (inst->cmd) nargc += 2; if (inst->theme) nargc += 2; + if (inst->colorscheme) nargc += 2; nargv = calloc(nargc + 1, sizeof(char *)); if (!nargv) return; @@ -247,6 +255,11 @@ main_ipc_new(Ipc_Instance *inst) nargv[i++] = "-t"; nargv[i++] = (char *)inst->theme; } + if (inst->colorscheme) + { + nargv[i++] = "--colorscheme"; + nargv[i++] = (char *)inst->colorscheme; + } if (inst->role) { nargv[i++] = "-r"; @@ -500,6 +513,8 @@ static Ecore_Getopt options = { gettext_noop("Highlight links")), ECORE_GETOPT_STORE_BOOL('\0', "no-wizard", gettext_noop("Do not display wizard on start up")), + ECORE_GETOPT_STORE_STR ('\0', "colorscheme", + gettext_noop("Use the named color scheme")), ECORE_GETOPT_VERSION ('V', "version"), ECORE_GETOPT_COPYRIGHT ('C', "copyright"), @@ -832,6 +847,7 @@ elm_main(int argc, char **argv) ECORE_GETOPT_VALUE_DOUBLE(scale), ECORE_GETOPT_VALUE_BOOL(instance.active_links), ECORE_GETOPT_VALUE_BOOL(no_wizard), + ECORE_GETOPT_VALUE_STR(instance.colorscheme), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option),