/* command function arg mode */
{"open", command_open, {VP_TARGET_CURRENT, ""}, VP_MODE_NORMAL},
{"tabopen", command_open, {VP_TARGET_NEW, ""}, VP_MODE_NORMAL},
+ {"open-home", command_open_home, {VP_TARGET_CURRENT, ""}, VP_MODE_NORMAL},
+ {"tabopen-home", command_open_home, {VP_TARGET_NEW, ""}, VP_MODE_NORMAL},
{"input", command_input, {0, ":"}, VP_MODE_COMMAND},
{"inputopen", command_input, {0, ":open "}, VP_MODE_COMMAND},
{"inputtabopen", command_input, {0, ":tabopen "}, VP_MODE_COMMAND},
return vp_load_uri(arg);
}
+gboolean command_open_home(const Arg* arg)
+{
+ gboolean result;
+
+ Arg a = {.i = arg->i, .s = vp.config.home_page};
+ result = vp_load_uri(&a);
+
+ return result;
+}
+
gboolean command_input(const Arg* arg)
{
const gchar* url;
gboolean command_run(const gchar* name, const gchar* param);
gboolean command_open(const Arg* arg);
+gboolean command_open_home(const Arg* arg);
gboolean command_input(const Arg* arg);
gboolean command_close(const Arg* arg);
gboolean command_view_source(const Arg* arg);
#include "stdlib.h"
-#define START_PAGE "https://github.com/fanglingsu/vimp"
-
-#define SETTING_DEFAUL_FONT_SIZE 12
#define SETTING_MAX_CONNS 25
#define SETTING_MAX_CONNS_PER_HOST 5
{"nmap t=inputtabopen"},
{"nmap O=inputopencurrent"},
{"nmap T=inputtabopencurrent"},
+ {"nmap gh=open-home"},
+ {"nmap gH=tabopen-home"},
{"nmap d=quit"},
{"nmap <ctrl-o>=back"},
{"nmap <ctrl-i>=forward"},
if (argc > 1) {
arg.s = g_strdup(argv[argc - 1]);
} else {
- arg.s = g_strdup(START_PAGE);
+ arg.s = g_strdup(vp.config.home_page);
}
vp_load_uri(&arg);
g_free(arg.s);
time_t cookie_timeout;
gint scrollstep;
guint max_completion_items;
+ gchar* home_page;
} Config;
typedef struct {
static gboolean setting_hint_style(const Setting* s, const gboolean get);
static gboolean setting_strict_ssl(const Setting* s, const gboolean get);
static gboolean setting_ca_bundle(const Setting* s, const gboolean get);
+static gboolean setting_home_page(const Setting* s, const gboolean get);
static Setting default_settings[] = {
/* webkit settings */
{NULL, "hint-style", TYPE_CHAR, setting_hint_style, {.s = "font-family:monospace;font-weight:bold;color:#000;background-color:#fff;margin:0;padding:0px 1px;border:1px solid #444;opacity:0.7;"}},
{NULL, "strict-ssl", TYPE_BOOLEAN, setting_strict_ssl, {.i = 1}},
{NULL, "ca-bundle", TYPE_CHAR, setting_ca_bundle, {.s = "/etc/ssl/certs/ca-certificates.crt"}},
+ {NULL, "home-page", TYPE_CHAR, setting_home_page, {.s = "https://github.com/fanglingsu/vimp"}},
};
return TRUE;
}
+
+static gboolean setting_home_page(const Setting* s, const gboolean get)
+{
+ if (get) {
+ setting_print_value(s, vp.config.home_page);
+ } else {
+ OVERWRITE_STRING(vp.config.home_page, s->arg.s);
+ }
+
+ return TRUE;
+}