summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/dwb.14
-rw-r--r--src/commands.c15
-rw-r--r--src/commands.h1
-rw-r--r--src/config.h1
-rw-r--r--src/dwb.c2
-rw-r--r--src/dwb.h6
-rw-r--r--util/keys.in1
7 files changed, 27 insertions, 3 deletions
diff --git a/doc/dwb.1 b/doc/dwb.1
index b7fba5aa..cd77688f 100644
--- a/doc/dwb.1
+++ b/doc/dwb.1
@@ -117,6 +117,10 @@ Add a new blank view (command
Close current view (command
.BR remove_view ).
.TP
+.BR co
+Close all tabs except for the current one (command
+.BR only ).
+.TP
.BR C-q
Quit (command
.BR quit ).
diff --git a/src/commands.c b/src/commands.c
index de96787a..3d720860 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -891,4 +891,19 @@ DwbStatus
commands_command_mode(KeyMap *km, Arg *arg) {
return dwb_change_mode(COMMAND_MODE);
}/*}}}*/
+/* dwb_command_mode {{{*/
+DwbStatus
+commands_only(KeyMap *km, Arg *arg) {
+ DwbStatus ret = STATUS_ERROR;
+ GList *l = dwb.state.views, *next;
+ while (l) {
+ next = l->next;
+ if (l != dwb.state.fview) {
+ view_remove(l);
+ ret = STATUS_OK;
+ }
+ l = next;
+ }
+ return ret;
+}/*}}}*/
/*}}}*/
diff --git a/src/commands.h b/src/commands.h
index 7afe981b..477e9d35 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -91,5 +91,6 @@ DwbStatus commands_pass_through(KeyMap *, Arg *);
DwbStatus commands_open_editor(KeyMap *, Arg *);
DwbStatus commands_insert_mode(KeyMap *, Arg *);
DwbStatus commands_command_mode(KeyMap *, Arg *);
+DwbStatus commands_only(KeyMap *, Arg *);
#endif
diff --git a/src/config.h b/src/config.h
index cadc21e3..85433bdf 100644
--- a/src/config.h
+++ b/src/config.h
@@ -24,6 +24,7 @@ static KeyValue KEYS[] = {
{ "bookmarks_nv", { "gB", 0, }, },
{ "bookmarks_nw", { "wB", 0, }, },
{ "command_mode", { ":", 0, }, },
+ { "only", { "co", 0, }, },
{ "find_forward", { "/", 0, }, },
{ "find_next", { "n", 0, }, },
{ "find_previous", { "N", 0, }, },
diff --git a/src/dwb.c b/src/dwb.c
index 010efa4a..1c00c05f 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -199,6 +199,8 @@ static FunctionMap FMAP [] = {
(Func)commands_stop_loading, NULL, ALWAYS_SM, },
{ { "remove_view", "Close view", }, 1,
(Func)commands_remove_view, NULL, ALWAYS_SM, },
+ { { "only", "Close other tabs except for current", }, 1,
+ (Func)commands_only, "No other view", ALWAYS_SM, },
{ { "save_quickmark", "Save a quickmark for this page", }, CP_COMMANDLINE | CP_HAS_MODE,
(Func)commands_quickmark, NO_URL, NEVER_SM, { .n = QUICK_MARK_SAVE }, },
{ { "save_search_field", "Add a new searchengine", }, CP_COMMANDLINE | CP_HAS_MODE,
diff --git a/src/dwb.h b/src/dwb.h
index 1cc9eafe..7e2a1e78 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -74,12 +74,12 @@
#include <gtk/gtkx.h>
#endif
-#ifndef true
-#define true 1
-#endif
#ifndef false
#define false 0
#endif
+#ifndef true
+#define !false
+#endif
#if _HAS_GTK3
#define DwbColor GdkRGBA
diff --git a/util/keys.in b/util/keys.in
index 0a025626..c77b6fb1 100644
--- a/util/keys.in
+++ b/util/keys.in
@@ -74,6 +74,7 @@ scroll_percent Scroll to percentage
# tabs Tabs &amp UI
add_view Add a new view
remove_view Close view
+only Close all tabs except for the current one
undo Undo closing last tab
decrease_master Decrease master area
increase_master Increase master area