about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-06-26 09:45:25 -0400
committerJosh Rickmar <jrick@devio.us>2012-06-28 15:29:46 -0400
commit708b5e49dca962e66b774416aefdd377040bc55c (patch)
tree6500f9a6fffafd8f234575c5e1c7984096966f48
parent778314350a27c698799439f8e4d5c3b3e536f492 (diff)
downloadxombrero-708b5e49dca962e66b774416aefdd377040bc55c.tar.gz
Implement a tabonly command that deletes all tabs except the currently
focused one. Document in manpage.
-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)
n224' href='#n224'>224 225 226