about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--xombrero.12
-rw-r--r--xombrero.c8
-rw-r--r--xombrero.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/xombrero.1 b/xombrero.1
index 3cebb2f..33224d1 100644
--- a/xombrero.1
+++ b/xombrero.1
@@ -661,6 +661,8 @@ Hide tabs.
 Create new tab and optionally open provided URL.
 .It Cm tabnext
 Go to the next tab.
+.It Cm tabonly
+Close all tabs except the currently focused one.
 .It Cm tabprevious
 Go to the previous tab.
 .It Cm tabshow
diff --git a/xombrero.c b/xombrero.c
index d1a8eab..88fab6d 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -2544,7 +2544,7 @@ tabaction(struct tab *t, struct karg *args)
 	int			rv = XT_CB_HANDLED;
 	char			*url = args->s;
 	struct undo		*u;
-	struct tab		*tt;
+	struct tab		*tt, *tv;
 
 	DNPRINTF(XT_D_TAB, "tabaction: %p %d\n", t, args->i);
 
@@ -2574,6 +2574,11 @@ tabaction(struct tab *t, struct karg *args)
 		else
 			quit(t, args);
 		break;
+	case XT_TAB_ONLY:
+		TAILQ_FOREACH_SAFE(tt, &tabs, entry, tv)
+			if (t != tt)
+				delete_tab(tt);
+		break;
 	case XT_TAB_OPEN:
 		if (strlen(url) > 0)
 			;
@@ -3316,6 +3321,7 @@ struct cmd {
 	{ "tabnew",		0,	tabaction,		XT_TAB_NEW,		XT_PREFIX | XT_URLARG },
 	{ "tabnext",		0,	movetab,		XT_TAB_NEXT,		XT_PREFIX | XT_INTARG},
 	{ "tabnextstyle",	0,	tabaction,		XT_TAB_NEXTSTYLE,	0 },
+	{ "tabonly",		0,	tabaction,		XT_TAB_ONLY,		0 },
 	{ "tabprevious",	0,	movetab,		XT_TAB_PREV,		XT_PREFIX | XT_INTARG},
 	{ "tabrewind",		0,	movetab,		XT_TAB_FIRST,		0 },
 	{ "tabshow",		0,	tabaction,		XT_TAB_SHOW,		0 },
diff --git a/xombrero.h b/xombrero.h
index 28e4770..a1511e9 100644
--- a/xombrero.h
+++ b/xombrero.h
@@ -659,6 +659,7 @@ int		command_mode(struct tab *, struct karg *);
 #define XT_TAB_HIDE		(7)
 #define XT_TAB_NEXTSTYLE	(8)
 #define XT_TAB_LOAD_IMAGES	(9)
+#define XT_TAB_ONLY		(10)
 
 #define XT_URL_SHOW		(1)
 #define XT_URL_HIDE		(2)