about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--about.c2
-rw-r--r--settings.c8
-rw-r--r--unix.c3
-rw-r--r--xombrero.142
-rw-r--r--xombrero.c159
-rw-r--r--xombrero.conf8
6 files changed, 101 insertions, 121 deletions
diff --git a/about.c b/about.c
index b25cee1..f563b0c 100644
--- a/about.c
+++ b/about.c
@@ -249,7 +249,6 @@ about(struct tab *t, struct karg *args)
 #ifdef WEBKITGTK_API_VERSION
 	    "<br><b>WebKit API: %.1f</b>"
 #endif
-	    "<br><b>Home dir: %s</b>"
 	    "<p>"
 	    "Authors:"
 	    "<ul>"
@@ -274,7 +273,6 @@ about(struct tab *t, struct karg *args)
 #ifdef WEBKITGTK_API_VERSION
 	    ,WEBKITGTK_API_VERSION
 #endif
-	    ,pwd->pw_dir
 	    );
 
 	page = get_html_page("About", body, "", 0);
diff --git a/settings.c b/settings.c
index 6783aa1..633f3bd 100644
--- a/settings.c
+++ b/settings.c
@@ -1066,10 +1066,10 @@ struct key_binding	keys[] = {
 	{ "focusreset",		CTRL,	1,	GDK_0		},
 
 	/* command aliases (handy when -S flag is used) */
-	{ ":open ",		0,	1,	GDK_F9		},
-	{ ":open <uri>",	0,	1,	GDK_F10		},
-	{ ":tabnew ",		0,	1,	GDK_F11		},
-	{ ":tabnew <uri>",	0,	1,	GDK_F12		},
+	{ "promptopen",		0,	1,	GDK_F9		},
+	{ "promptopencurrent",	0,	1,	GDK_F10		},
+	{ "prompttabnew",	0,	1,	GDK_F11		},
+	{ "prompttabnewcurrent",0,	1,	GDK_F12		},
 };
 
 void
diff --git a/unix.c b/unix.c
index a5a765e..93f9948 100644
--- a/unix.c
+++ b/unix.c
@@ -16,9 +16,6 @@
 
 #include <xombrero.h>
 
-/* put this here for now, move away if unix needs something special */
-void	(*os_init)(void);
-
 int
 fork_exec(struct tab *t, char *argv0, const gchar *argv1, char *error, int loud)
 {
diff --git a/xombrero.1 b/xombrero.1
index da50668..69154ab 100644
--- a/xombrero.1
+++ b/xombrero.1
@@ -135,7 +135,7 @@ Each keyboard shortcut requires exactly one entry in the configuration file.
 A shortcut can have multiple entries in the configuration file.
 The format of the keybinding entry is as follows:
 .Pp
-.D1 keybinding = (:)action,(!)keystroke(s)
+.D1 keybinding = action,(!)keystroke(s)
 .Pp
 For example, "keybinding = tabnew,C-t" where
 .Cm tabnew
@@ -143,17 +143,6 @@ is the action and
 .Cm C-t
 are
 the keystrokes.
-.Pp
-If the action begins with a colon, the action will be entered into the
-command prompt instead of being executed.
-For example, "keybinding = :session open ,M-s" will open the command
-prompt with ":open session " entered when using the M-s keybinding.
-.Pp
-Keybindings which open the command prompt may also include the string
-<uri>, which will be replaced by the current tab's URI.
-For example, "keybinding = :open <uri>,F10" will open the command
-prompt with <uri> replaced with the current URI.
-.Pp
 GTK has some default keybindings for manipulating text inside input
 fields, such as the URI or search entry widget, for example
 .Cm C-w
@@ -216,30 +205,29 @@ Focus on search entry
 .El
 .Ss Command Aliases
 These commands allow the user to map specific actions to specific keys.
+It can be useful when the
+.Fl S
+option is used.
 .Pp
 .Bl -tag -width Ds -offset indent -compact
 .It Cm F1
-Alias for "help"
+Alias for ":help"
 .It Cm F2
-Alias for "proxy toggle"
+Alias for ":proxy toggle"
 .It Cm F4
-Alias for "toplevel toggle"
-.El
-.Ss Prompt Aliases
-These commands allow the user to open a prompt.
-These can be useful when the
-.Fl S
-option is used.
-.Pp
-.Bl -tag -width Ds -offset indent -compact
+Alias for ":toplevel toggle"
 .It Cm F9
-Alias for ":open "
+Alias for ":open"
+.Pq Cm promptopen
 .It Cm F10
-Alias for ":open <uri>"
+Alias for ":open current-uri"
+.Pq Cm promptopencurrent
 .It Cm F11
-Alias for ":tabnew "
+Alias for ":tabnew"
+.Pq Cm prompttabnew
 .It Cm F12
-Alias for ":tabnew <uri>"
+Alias for ":tabnew current-uri"
+.Pq Cm prompttabnewcurrent
 .El
 .Ss Navigation Commands
 These commands allow the user to navigate web pages and,
diff --git a/xombrero.c b/xombrero.c
index 4b16a8d..6835fb7 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -167,6 +167,11 @@ TAILQ_HEAD(command_list, command_entry);
 #define XT_ZOOM_OUT		(-2)
 #define XT_ZOOM_NORMAL		(100)
 
+#define XT_CMD_OPEN		(0)
+#define XT_CMD_OPEN_CURRENT	(1)
+#define XT_CMD_TABNEW		(2)
+#define XT_CMD_TABNEW_CURRENT	(3)
+
 #define XT_STATUS_NOTHING	(0)
 #define XT_STATUS_LINK		(1)
 #define XT_STATUS_URI		(2)
@@ -2610,21 +2615,14 @@ movetab(struct tab *t, struct karg *args)
 
 int cmd_prefix = 0;
 
-struct prompt_sub {
-	const char		*s;
-	const char		*(*f)(struct tab *);
-} subs[] = {
-	{ "<uri>",	get_uri },
-};
 
 int
 command(struct tab *t, struct karg *args)
 {
-	struct karg		a;
-	int			i;
-	char			*s = NULL, *sp = NULL, *sl = NULL;
-	gchar			**sv;
+	char			*s = NULL, *ss = NULL;
 	gchar			*text, *base;
+	const gchar		*uri;
+	struct karg		a;
 
 	if (t == NULL || args == NULL) {
 		show_oops(NULL, "command invalid parameters");
@@ -2639,31 +2637,13 @@ command(struct tab *t, struct karg *args)
 		s = "?";
 		break;
 	case ':':
-		if (cmd_prefix == 0) {
-			if (args->s != NULL && strlen(args->s) != 0) {
-				ss = g_strdup_printf(":%s", args->s);
-				s = sp;
-			} else
-				s = ":";
-		} else {
+		if (cmd_prefix == 0)
+			s = ":";
+		else {
 			ss = g_strdup_printf(":%d", cmd_prefix);
-			s = sp;
+			s = ss;
 			cmd_prefix = 0;
 		}
-		sl = g_strdup(s);
-		if (sp) {
-			g_free(sp);
-			sp = NULL;
-		}
-		s = sl;
-		for (i = 0; i < sizeof subs / sizeof (struct prompt_sub); ++i) {
-			sv = g_strsplit(sl, subs[i].s, -1);
-			if (sl)
-				g_free(sl);
-			sl = g_strjoinv(subs[i].f(t), sv);
-			g_strfreev(sv);
-			s = sl;
-		}
 		break;
 	case '.':
 		t->mode = XT_MODE_HINT;
@@ -2679,6 +2659,23 @@ command(struct tab *t, struct karg *args)
 		hint(t, &a);
 		s = ",";
 		break;
+	case XT_CMD_OPEN:
+		s = ":open ";
+		break;
+	case XT_CMD_TABNEW:
+		s = ":tabnew ";
+		break;
+	case XT_CMD_OPEN_CURRENT:
+		s = ":open ";
+		/* FALL THROUGH */
+	case XT_CMD_TABNEW_CURRENT:
+		if (!s) /* FALL THROUGH? */
+			s = ":tabnew ";
+		if ((uri = get_uri(t)) != NULL) {
+			ss = g_strdup_printf("%s%s", s, uri);
+			s = ss;
+		}
+		break;
 	default:
 		show_oops(t, "command: invalid opcode %d", args->i);
 		return (XT_CB_PASSTHROUGH);
@@ -2698,10 +2695,8 @@ command(struct tab *t, struct karg *args)
 	gtk_widget_grab_focus(GTK_WIDGET(t->cmd));
 	gtk_editable_set_position(GTK_EDITABLE(t->cmd), -1);
 
-	if (sp)
-		g_free(sp);
-	if (sl)
-		g_free(sl);
+	if (ss)
+		g_free(ss);
 
 	return (XT_CB_HANDLED);
 }
@@ -3198,6 +3193,12 @@ struct cmd {
 	{ "encoding",		0,	set_encoding,		0,			XT_USERARG },
 	{ "loadimages",		0,	tabaction,		XT_TAB_LOAD_IMAGES,	0 },
 
+	/* command aliases (handy when -S flag is used) */
+	{ "promptopen",		0,	command,		XT_CMD_OPEN,		0 },
+	{ "promptopencurrent",	0,	command,		XT_CMD_OPEN_CURRENT,	0 },
+	{ "prompttabnew",	0,	command,		XT_CMD_TABNEW,		0 },
+	{ "prompttabnewcurrent",0,	command,		XT_CMD_TABNEW_CURRENT,	0 },
+
 	/* settings */
 	{ "set",		0,	set,			0,			XT_SETARG },
 
@@ -5416,7 +5417,6 @@ done:
 gboolean
 handle_keypress(struct tab *t, GdkEventKey *e, int entry)
 {
-	struct karg		args;
 	struct key_binding	*k;
 
 	/* handle keybindings if buffercmd is empty.
@@ -5431,15 +5431,11 @@ handle_keypress(struct tab *t, GdkEventKey *e, int entry)
 				    (e->state & CTRL || e->state & MOD1))
 					return (XT_CB_PASSTHROUGH);
 
-				if ((k->mask == 0 &&
-				    (e->state & (CTRL | MOD1)) == 0) ||
-				    (e->state & k->mask) == k->mask) {
-					if (k->cmd[0] == ':') {
-						args.i = ':';
-						args.s = &k->cmd[1];
-						return command(t, &args);
-					} else
+				if (k->mask == 0) {
+					if ((e->state & (CTRL | MOD1)) == 0)
 						return (cmd_execute(t, k->cmd));
+				} else if ((e->state & k->mask) == k->mask) {
+					return (cmd_execute(t, k->cmd));
 				}
 			}
 
@@ -6453,36 +6449,38 @@ create_toolbar(struct tab *t)
 	toolbar = b;
 	gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
 
-	/* backward button */
-	t->backward = create_button("Back", GTK_STOCK_GO_BACK, 0);
-	gtk_widget_set_sensitive(t->backward, FALSE);
-	g_signal_connect(G_OBJECT(t->backward), "clicked",
-	    G_CALLBACK(backward_cb), t);
-	gtk_box_pack_start(GTK_BOX(b), t->backward, FALSE, FALSE, 0);
-
-	/* forward button */
-	t->forward = create_button("Forward",GTK_STOCK_GO_FORWARD, 0);
-	gtk_widget_set_sensitive(t->forward, FALSE);
-	g_signal_connect(G_OBJECT(t->forward), "clicked",
-	    G_CALLBACK(forward_cb), t);
-	gtk_box_pack_start(GTK_BOX(b), t->forward, FALSE,
-	    FALSE, 0);
-
-	/* stop button */
-	t->stop = create_button("Stop", GTK_STOCK_STOP, 0);
-	gtk_widget_set_sensitive(t->stop, FALSE);
-	g_signal_connect(G_OBJECT(t->stop), "clicked",
-	    G_CALLBACK(stop_cb), t);
-	gtk_box_pack_start(GTK_BOX(b), t->stop, FALSE,
-	    FALSE, 0);
-
-	/* JS button */
-	t->js_toggle = create_button("JS-Toggle", enable_scripts ?
-	    GTK_STOCK_MEDIA_PLAY : GTK_STOCK_MEDIA_PAUSE, 0);
-	gtk_widget_set_sensitive(t->js_toggle, TRUE);
-	g_signal_connect(G_OBJECT(t->js_toggle), "clicked",
-	    G_CALLBACK(js_toggle_cb), t);
-	gtk_box_pack_start(GTK_BOX(b), t->js_toggle, FALSE, FALSE, 0);
+	if (fancy_bar) {
+		/* backward button */
+		t->backward = create_button("Back", GTK_STOCK_GO_BACK, 0);
+		gtk_widget_set_sensitive(t->backward, FALSE);
+		g_signal_connect(G_OBJECT(t->backward), "clicked",
+		    G_CALLBACK(backward_cb), t);
+		gtk_box_pack_start(GTK_BOX(b), t->backward, FALSE, FALSE, 0);
+
+		/* forward button */
+		t->forward = create_button("Forward",GTK_STOCK_GO_FORWARD, 0);
+		gtk_widget_set_sensitive(t->forward, FALSE);
+		g_signal_connect(G_OBJECT(t->forward), "clicked",
+		    G_CALLBACK(forward_cb), t);
+		gtk_box_pack_start(GTK_BOX(b), t->forward, FALSE,
+		    FALSE, 0);
+
+		/* stop button */
+		t->stop = create_button("Stop", GTK_STOCK_STOP, 0);
+		gtk_widget_set_sensitive(t->stop, FALSE);
+		g_signal_connect(G_OBJECT(t->stop), "clicked",
+		    G_CALLBACK(stop_cb), t);
+		gtk_box_pack_start(GTK_BOX(b), t->stop, FALSE,
+		    FALSE, 0);
+
+		/* JS button */
+		t->js_toggle = create_button("JS-Toggle", enable_scripts ?
+		    GTK_STOCK_MEDIA_PLAY : GTK_STOCK_MEDIA_PAUSE, 0);
+		gtk_widget_set_sensitive(t->js_toggle, TRUE);
+		g_signal_connect(G_OBJECT(t->js_toggle), "clicked",
+		    G_CALLBACK(js_toggle_cb), t);
+		gtk_box_pack_start(GTK_BOX(b), t->js_toggle, FALSE, FALSE, 0);
+	}
 
 	t->uri_entry = gtk_entry_new();
 	g_signal_connect(G_OBJECT(t->uri_entry), "activate",
@@ -6496,7 +6494,7 @@ create_toolbar(struct tab *t)
 	gtk_box_pack_start(GTK_BOX(b), eb1, TRUE, TRUE, 0);
 
 	/* search entry */
-	if (search_string != NULL && strlen(search_string) != 0) {
+	if (fancy_bar && search_string != NULL && strlen(search_string) != 0) {
 		GtkWidget *eb2;
 		t->search_entry = gtk_entry_new();
 		gtk_entry_set_width_chars(GTK_ENTRY(t->search_entry), 30);
@@ -6890,7 +6888,7 @@ create_new_tab(char *title, struct undo *u, int focus, int position)
 		    0);
 	} else {
 		t->toolbar = create_toolbar(t);
-		if (fancy_bar)
+		if (show_url)
 			gtk_box_pack_start(GTK_BOX(t->vbox), t->toolbar, FALSE,
 			    FALSE, 0);
 	}
@@ -7696,6 +7694,9 @@ main(int argc, char **argv)
 
 	start_argv = (char * const *)argv;
 
+	if (os_init)
+		os_init();
+
 	/* prepare gtk */
 #ifdef USE_THREADS
 #if !defined __MINGW32__
@@ -7835,10 +7836,6 @@ main(int argc, char **argv)
 	spell_check_languages = g_strdup("en_US");
 	encoding = g_strdup("UTF-8");
 
-	/* override os specific settings */
-	if (os_init)
-		os_init();
-
 	/* read config file */
 	if (strlen(conf) == 0)
 		snprintf(conf, sizeof conf, "%s" PS ".%s",
diff --git a/xombrero.conf b/xombrero.conf
index 19b7bdd..0bd2878 100644
--- a/xombrero.conf
+++ b/xombrero.conf
@@ -298,6 +298,10 @@
 # keybinding	= searchprevious,N
 # keybinding	= focusaddress,F6
 # keybinding	= focussearch,F7
+# keybinding	= promptopen,F9
+# keybinding	= promptopencurrent,F10
+# keybinding	= prompttabnew,F11
+# keybinding	= prompttabnewcurrent,F12
 # keybinding	= hinting,f
 # keybinding	= hinting,period
 # keybinding	= hinting_newtab,S-F
@@ -356,10 +360,6 @@
 # keybinding	= focusreset,C-0
 # keybinding	= editelement,!C-i
 # keybinding	= passthrough,C-z
-# keybinding	= :open ,F9
-# keybinding	= :open <uri>,F10
-# keybinding	= :tabopen ,F11
-# keybinding	= :tabopen <uri>,F12
 
 # parse the contents of another configuration file
 # include_config	= ~/.xombrero_alternate.conf