From ceff22d28a8978bda732ad2b89839dd8e4c5eca0 Mon Sep 17 00:00:00 2001 From: Sadoon AlBader Date: Sat, 25 Sep 2021 10:36:27 +0300 Subject: status bar settings now configurable with config.h --- src/config.def.h | 11 +++++++++++ src/main.c | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/config.def.h b/src/config.def.h index a58e520..fd70a51 100644 --- a/src/config.def.h +++ b/src/config.def.h @@ -90,3 +90,14 @@ #define SETTING_DOWNLOAD_COMMAND "/bin/sh -c \"curl -sLJOC - -e '$neovimb_URI' %s\"" #define SETTING_HINT_KEYS "0123456789" + +/* These are the three settings displayed when "status-bar-show-settings" is enabled + * With booleans, please use GET_BOOL and append ( ? "on" : "off" ) + * With integers, you could just print the value and use GET_INT + * Strings do not need any additional modifications, use GET_CHAR */ +#define STATUS_NAME1 "js" +#define STATUS_TYPE1 GET_BOOL(c, "scripts") ? "on" : "off" +#define STATUS_NAME2 "cookies" +#define STATUS_TYPE2 GET_CHAR(c, "cookie-accept") +#define STATUS_NAME3 "storage" +#define STATUS_TYPE3 GET_BOOL(c, "html5-local-storage") ? "on" : "off" diff --git a/src/main.c b/src/main.c index 06f0fae..b499918 100644 --- a/src/main.c +++ b/src/main.c @@ -641,10 +641,10 @@ void vb_statusbar_update(Client *c) #endif if ( c->config.statusbar_show_settings ) { - /* show js, cookies, and local storage status */ - g_string_append_printf(status, " js: %s |", GET_BOOL(c, "scripts") ? "on" : "off"); - g_string_append_printf(status, " cookies: %s |", GET_CHAR(c, "cookie-accept") ); - g_string_append_printf(status, " storage: %s", GET_BOOL(c, "html5-local-storage") ? "on" : "off"); + /* show 3 user defined variables on statusbar. can add more by using same template */ + g_string_append_printf(status, " %s: %s |", STATUS_NAME1, STATUS_TYPE1 ); + g_string_append_printf(status, " %s: %s |", STATUS_NAME2, STATUS_TYPE2 ); + g_string_append_printf(status, " %s: %s |", STATUS_NAME3, STATUS_TYPE3 ); } /* show the scroll status */ -- cgit v1.2.3