diff options
-rw-r--r-- | doc/dwb.1 | 3 | ||||
-rw-r--r-- | src/commands.c | 5 | ||||
-rw-r--r-- | src/config.h | 3 | ||||
-rw-r--r-- | src/dwb.c | 9 | ||||
-rw-r--r-- | src/dwb.h | 2 | ||||
-rw-r--r-- | src/util.c | 5 | ||||
-rw-r--r-- | src/util.h | 1 | ||||
-rw-r--r-- | src/view.c | 3 | ||||
-rw-r--r-- | util/keys.in | 1 |
9 files changed, 21 insertions, 11 deletions
@@ -464,6 +464,9 @@ Toggle visibility of tabbar. .BR xb Toggle visibility of statusbar. .TP +.BR xv +Toggle visibility of a tab. +.TP .BR C-M-p Print focused frame. .TP diff --git a/src/commands.c b/src/commands.c index ecb5913b..48a13046 100644 --- a/src/commands.c +++ b/src/commands.c @@ -869,8 +869,11 @@ commands_toggle_protected(KeyMap *km, Arg *arg) { DwbStatus commands_toggle_lock_protect(KeyMap *km, Arg *arg) { GList *gl = dwb.state.nummod < 0 ? dwb.state.fview : g_list_nth(dwb.state.views, dwb.state.nummod-1); - VIEW(gl)->status->lockprotect ^= arg->n; + View *v = VIEW(gl); + v->status->lockprotect ^= arg->n; dwb_tab_label_set_text(gl, NULL); + if (arg->n & LP_VISIBLE && gl != dwb.state.fview) + gtk_widget_set_visible(v->scroll, LP_VISIBLE(v)); return STATUS_OK; } /*}}}*/ diff --git a/src/config.h b/src/config.h index d5583f9a..522de8d0 100644 --- a/src/config.h +++ b/src/config.h @@ -161,6 +161,7 @@ static KeyValue KEYS[] = { { "lock_uri", { "xu", 0 }, }, { "lock_domain", { "xd", 0 }, }, { "back_new_tab", { "xb", 0 }, }, + { "visible", { "xv", 0 }, }, }; /* FUNCTION_MAP{{{*/ @@ -181,6 +182,8 @@ static FunctionMap FMAP [] = { (Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_LOCK_DOMAIN } }, { { "lock_uri", "Lock/unlock uri for this tab" }, 1, (Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_LOCK_URI } }, + { { "visible", "Lock/unlock uri for this tab" }, 1, + (Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_VISIBLE } }, { { "allow_cookie", "Cookie allowed", }, 1, (Func)commands_allow_cookie, "No new domain in current context", POST_SM, }, { { "bookmark", "Bookmark current page", }, 1, @@ -828,7 +828,8 @@ void dwb_focus_view(GList *gl) { if (gl != dwb.state.fview) { gtk_widget_show(VIEW(gl)->scroll); - gtk_widget_hide(VIEW(dwb.state.fview)->scroll); + if (! (CURRENT_VIEW()->status->lockprotect & LP_VISIBLE) ) + gtk_widget_hide(VIEW(dwb.state.fview)->scroll); dwb_unfocus(); dwb_focus(gl); } @@ -1522,7 +1523,7 @@ dwb_tab_label_set_text(GList *gl, const char *text) { View *v = gl->data; const char *uri = text ? text : webkit_web_view_get_title(WEBKIT_WEB_VIEW(v->web)); char progress[11] = { 0 }; - char buf[4] = { 0 }; + char buf[45] = { 0 }; int i=0; char sep1 = 0, sep2 = 0; if (v->status->lockprotect != 0) { @@ -1534,6 +1535,8 @@ dwb_tab_label_set_text(GList *gl, const char *text) { buf[i++] = 'd'; if (LP_LOCKED_URI(v)) buf[i++] = 'u'; + if (LP_VISIBLE(v)) + buf[i++] = 'v'; buf[i++] = '\0'; } if (v->status->progress != 0) { @@ -2727,7 +2730,7 @@ dwb_init_gui() { /* else * dwb.gui.topbox = gtk_vbox_new(true, 1); * */ - dwb.gui.mainbox = gtk_hbox_new(true, 0); + dwb.gui.mainbox = gtk_hbox_new(true, 1); /* Downloadbar */ dwb.gui.downloadbar = gtk_hbox_new(false, 3); @@ -234,10 +234,12 @@ typedef enum { LP_PROTECT = 1<<0, LP_LOCK_DOMAIN = 1<<1, LP_LOCK_URI = 1<<2, + LP_VISIBLE = 1<<3, } LockProtect; #define LP_PROTECTED(v) ((v)->status->lockprotect & LP_PROTECT) #define LP_LOCKED_DOMAIN(v) ((v)->status->lockprotect & LP_LOCK_DOMAIN) #define LP_LOCKED_URI(v) ((v)->status->lockprotect & LP_LOCK_URI) +#define LP_VISIBLE(v) ((v)->status->lockprotect & LP_VISIBLE) typedef enum { HINT_T_ALL = 0, @@ -545,11 +545,6 @@ dwb_quickmark_free(Quickmark *q) { /* dwb_true, dwb_false {{{*/ gboolean -dwb_false() { - return false; -} - -gboolean dwb_true() { return true; }/*}}}*/ @@ -73,7 +73,6 @@ int util_quickmark_compare(Quickmark *a, Quickmark *b); // useless gboolean dwb_true(void); -gboolean dwb_false(void); char * dwb_return(const char *); void * dwb_malloc(size_t); @@ -903,7 +903,8 @@ view_add(const char *uri, gboolean background) { gtk_widget_hide(v->scroll); } else { - gtk_widget_hide(VIEW(dwb.state.fview)->scroll); + if (! (CURRENT_VIEW()->status->lockprotect & LP_VISIBLE) ) + gtk_widget_hide(VIEW(dwb.state.fview)->scroll); dwb_unfocus(); dwb_focus(ret); } diff --git a/util/keys.in b/util/keys.in index ebdda8d2..6bd7eb5f 100644 --- a/util/keys.in +++ b/util/keys.in @@ -95,6 +95,7 @@ toggle_bottombar Toggle bottombar toggle_topbar Toggle tabbar protect Protect/unprotect tab presentation_mode Toggle presentation mode +visible Toggle visibility of a tab # completion Completion buffers Show all open tabs |