aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormutantturkey <mutantturke@gmail.com>2012-08-29 16:42:43 -0400
committermutantturkey <mutantturke@gmail.com>2012-08-29 16:42:43 -0400
commit1ce8c50a9a85f69b01b1744d720aaf40ca17e0f1 (patch)
treed112649febf097a0f70a6e0c4858aa318aac8025
parent433597f738c33a025c477f08dc4f94ecff31d63e (diff)
add a config setting for the default browser; update example svterc accordingly
-rw-r--r--example_svterc5
-rw-r--r--svte.c19
2 files changed, 22 insertions, 2 deletions
diff --git a/example_svterc b/example_svterc
index c6367f2..36a4649 100644
--- a/example_svterc
+++ b/example_svterc
@@ -1,3 +1,8 @@
+[general]
+
+# Specify a web browser you'd like, otherwise svte will use xdg-open
+# browser = firefox
+
[ui]
# true to enable bold text, false to disable it.
allow_bold=false
diff --git a/svte.c b/svte.c
index 45c4b67..da887c3 100644
--- a/svte.c
+++ b/svte.c
@@ -41,6 +41,7 @@ typedef struct {
gboolean audible_bell;
gboolean autohide_mouse;
gboolean allow_bold;
+ gchar *browser_command;
gchar *font;
gboolean fullscreen;
gint num_scrollback_lines;
@@ -113,7 +114,7 @@ static inline term* get_current_term(){
static void launch_url(char *url) {
- g_spawn_command_line_async(g_strconcat(DEFAULT_BROWSER_COMMAND, " ", url, NULL), NULL);
+ g_spawn_command_line_async(g_strconcat(config->browser_command, " ", url, NULL), NULL);
}
@@ -233,7 +234,7 @@ static char* tab_get_cwd(struct term* t)
char buf[255+1];
int len;
- file = g_strdup_printf ("/proc/%d/cwd", t->pid);
+ file = g_strdup_printf ("/proc/%d/cwd", (int)t->pid);
len = readlink (file, buf, sizeof (buf) - 1);
if (len > 0 && buf[0] == '/') {
@@ -461,6 +462,13 @@ static void parse_config_file(gchar *config_file) {
}
config = g_slice_new(Settings);
+
+ /* General Settings */
+ config->browser_command = g_key_file_get_string(
+ keyfile, "general", "browser", NULL);
+
+
+ /* UI Settings */
config->audible_bell = g_key_file_get_boolean(
keyfile, "ui", "audible_bell", NULL);
config->autohide_mouse = g_key_file_get_boolean(
@@ -493,6 +501,8 @@ static void parse_config_file(gchar *config_file) {
keyfile, "ui", "window_width", NULL);
config->word_chars = g_key_file_get_string(
keyfile, "ui", "word_chars", NULL);
+
+ /* Color Scheme Settings */
config->cursor = g_key_file_get_string(
keyfile, "colour scheme", "cursor", NULL);
@@ -519,11 +529,16 @@ static void parse_config_file(gchar *config_file) {
config->font = DEFAULT_FONT;
}
+ if(NULL == config->browser_command) {
+ config->browser_command = DEFAULT_BROWSER_COMMAND;
+ }
+
if (NULL == config->url_regex) {
config->url_regex = DEFAULT_URL_REGEX;
}
g_free(addid);
+ g_key_file_free(keyfile);
}