diff options
-rw-r--r-- | doc/dwb.1 | 10 | ||||
-rw-r--r-- | doc/dwb.1.txt | 3 | ||||
-rw-r--r-- | src/commands.c | 2 | ||||
-rw-r--r-- | src/config.h | 2 | ||||
-rw-r--r-- | src/dwb.c | 16 | ||||
-rw-r--r-- | src/dwb.h | 1 | ||||
-rw-r--r-- | src/view.c | 14 | ||||
-rw-r--r-- | util/settings.pre | 31 |
8 files changed, 59 insertions, 20 deletions
@@ -2,12 +2,12 @@ .\" Title: dwb .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> -.\" Date: 09/07/2012 +.\" Date: 09/17/2012 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB" "1" "09/07/2012" "\ \&" "\ \&" +.TH "DWB" "1" "09/17/2012" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -3432,6 +3432,12 @@ and available which can be used in a script, for example: .RE .PP +\fBshow\-single\-tab\fR +.RS 4 +Whether to show the tabbar if only one tab is open, default value: +\fItrue\fR\&. +.RE +.PP \fBsearchengine\-submit\-pattern\fR .RS 4 The pattern which will be replaced with the search terms\&. diff --git a/doc/dwb.1.txt b/doc/dwb.1.txt index 81149ca9..edfa918b 100644 --- a/doc/dwb.1.txt +++ b/doc/dwb.1.txt @@ -1436,6 +1436,9 @@ your application, so you can simply set this to 'xdg-open'. There are also the environment variables 'DWB_URI', 'DWB_SCHEME', 'DWB_COOKIES', 'DWB_USER_AGENT', and 'DWB_REFERER' available which can be used in a script, for example: +*show-single-tab*:: +Whether to show the tabbar if only one tab is open, default value: 'true'. + *searchengine-submit-pattern*:: The pattern which will be replaced with the search terms. diff --git a/src/commands.c b/src/commands.c index da2645da..5e85035c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -679,7 +679,7 @@ commands_only(KeyMap *km, Arg *arg) { }/*}}}*/ static void commands_set_bars(int status) { - gtk_widget_set_visible(dwb.gui.topbox, status & BAR_VIS_TOP); + gtk_widget_set_visible(dwb.gui.topbox, (status & BAR_VIS_TOP) && (GET_BOOL("show-single-tab") || dwb.state.views->next)); gtk_widget_set_visible(dwb.gui.bottombox, status & BAR_VIS_STATUS); if ((status & BAR_VIS_STATUS) ) { dwb_dom_remove_from_parent(WEBKIT_DOM_NODE(CURRENT_VIEW()->hover.element), NULL); diff --git a/src/config.h b/src/config.h index 7ce5e77c..ed1c098f 100644 --- a/src/config.h +++ b/src/config.h @@ -1165,4 +1165,6 @@ static WebSettings DWB_SETTINGS[] = { SETTING_GLOBAL, INTEGER, { .i = 0 }, NULL, { 0 }, }, { { "searchengine-submit-pattern", "The pattern which will be replaced with the search terms", }, SETTING_GLOBAL, CHAR, { .p = NULL }, NULL, { 0 }, }, + { { "show-single-tab", "Whether to show tabbar if only on tab is opened", }, + SETTING_GLOBAL | SETTING_ONINIT, BOOLEAN, { .b = true }, (S_Func)dwb_set_show_single_tab, { 0 }, }, };/*}}}*/ @@ -75,6 +75,7 @@ static DwbStatus dwb_set_close_last_tab_policy(GList *, WebSettings *); static DwbStatus dwb_set_ntlm(GList *gl, WebSettings *s); static DwbStatus dwb_set_find_delay(GList *gl, WebSettings *s); static DwbStatus dwb_set_do_not_track(GList *gl, WebSettings *s); +static DwbStatus dwb_set_show_single_tab(GList *gl, WebSettings *s); #ifdef WITH_LIBSOUP_2_38 static DwbStatus dwb_set_dns_lookup(GList *gl, WebSettings *s); #endif @@ -182,6 +183,21 @@ dwb_set_do_not_track(GList *gl, WebSettings *s) { return STATUS_OK; }/*}}}*/ +/* dwb_set_cookies {{{ */ +static DwbStatus +dwb_set_show_single_tab(GList *gl, WebSettings *s) { + dwb.misc.show_single_tab = s->arg_local.b; + if (dwb.state.views) { + if (!dwb.state.views->next) { + if (!dwb.misc.show_single_tab) + gtk_widget_hide(dwb.gui.topbox); + else if (dwb.state.bar_visible & BAR_VIS_TOP) + gtk_widget_show(dwb.gui.topbox); + } + } + return STATUS_OK; +}/*}}}*/ + static DwbStatus dwb_set_close_last_tab_policy(GList *gl, WebSettings *s) { if (!g_strcmp0("clear", s->arg_local.p)) @@ -759,6 +759,7 @@ struct _Misc { gboolean tabbed_browsing; gboolean private_browsing; + gboolean show_single_tab; double scroll_step; @@ -1131,6 +1131,8 @@ view_remove(GList *gl) { dwb_source_remove(); dwb.state.views = g_list_delete_link(dwb.state.views, gl); + if (!dwb.state.views->next && !dwb.misc.show_single_tab) + gtk_widget_hide(dwb.gui.topbox); gtk_widget_show(CURRENT_VIEW()->scroll); dwb_update_layout(); @@ -1169,10 +1171,11 @@ view_add(const char *uri, gboolean background) { } View *v = view_create_web_view(); gtk_box_pack_end(GTK_BOX(dwb.gui.topbox), v->tabevent, true, true, 0); + int length = g_list_length(dwb.state.views); if (dwb.state.fview) { int p; if (dwb.misc.tab_position & TAB_POSITION_RIGHTMOST) - p = g_list_length(dwb.state.views); + p = length; else if (dwb.misc.tab_position & TAB_POSITION_LEFT) p = g_list_position(dwb.state.views, dwb.state.fview); else if (dwb.misc.tab_position & TAB_POSITION_LEFTMOST) @@ -1180,7 +1183,7 @@ view_add(const char *uri, gboolean background) { else p = g_list_position(dwb.state.views, dwb.state.fview) + 1; - gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), v->tabevent, g_list_length(dwb.state.views) - p); + gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), v->tabevent, length - p); gtk_box_insert(GTK_BOX(dwb.gui.mainbox), v->scroll, true, true, 0, p, GTK_PACK_START); dwb.state.views = g_list_insert(dwb.state.views, v, p); ret = g_list_nth(dwb.state.views, p); @@ -1204,6 +1207,13 @@ view_add(const char *uri, gboolean background) { scripts_create_tab(ret); dwb_focus(ret); } + if (!dwb.misc.show_single_tab) { + if (length == 0) { + gtk_widget_hide(dwb.gui.topbox); + } + else if (length == 1 && (dwb.state.bar_visible & BAR_VIS_TOP)) + gtk_widget_show(dwb.gui.topbox); + } view_init_signals(ret); view_init_settings(ret); diff --git a/util/settings.pre b/util/settings.pre index f89709d3..ee24d2b4 100644 --- a/util/settings.pre +++ b/util/settings.pre @@ -45,13 +45,19 @@ sans-serif-font-family text Sans serif font family used to display text serif-font-family text Serif font family used to display text # colors Colors -foreground-color text Foreground color of the statusbar -background-color text Background color of the statusbar active-completion-bg-color text Background color of the active completion item active-completion-fg-color text Foreground color of the active completion item +background-color text Background color of the statusbar +download-bg-color text Background color of the download bar +download-fg-color text Foreground color of the download bar +download-gradient-end text End color for download progress gradient color +download-gradient-start text Start color for download progress gradient color error-color text Color for error messages +foreground-color text Foreground color of the statusbar normal-completion-bg-color text Background color of normal completion items normal-completion-fg-color text Foreground color of normal completion items +progress-bar-empty-color text Color of the empty part of the progress bar +progress-bar-full-color text Color of the full part of the progress bar prompt-color text Color for prompt messages ssl-trusted-color text Color for encrypted sites, trusted certificate ssl-untrusted-color text Color for encrypted sites, untrusted certificate @@ -60,36 +66,31 @@ status-blocked-color text Color for script blocker, status blocked tab-active-bg-color text Background color of the active tab tab-active-fg-color text Foreground color of the active tab tab-normal-bg-color-1 text Background color 1 of the normal tab -tab-normal-fg-color-1 text Foreground color 1 of the normal tab tab-normal-bg-color-2 text Background color 2 of the normal tab +tab-normal-fg-color-1 text Foreground color 1 of the normal tab tab-normal-fg-color-2 text Foreground color 2 of the normal tab tab-number-color text Color of the tabnumber tab-protected-color text Color of the tabnumber for protected tabs -download-fg-color text Foreground color of the download bar -download-bg-color text Background color of the download bar -download-gradient-start text Start color for download progress gradient color -download-gradient-end text End color for download progress gradient color -progress-bar-full-color text Color of the full part of the progress bar -progress-bar-empty-color text Color of the empty part of the progress bar # lt Layout background-tabs checkbox Whether to open tabs in background +bars-padding text Padding of the status, download, completion and tab bars close-tab-focus-policy select @right @left @rightmost @leftmost Controls the focused tab when a tab is closed default-height text Default height of the window default-width text Default width of the window -enable-frame-flattening checkbox Whether to enable frame flattening enable-favicon checkbox Whether to enable favicons in the tabbar +enable-frame-flattening checkbox Whether to enable frame flattening enforce-96-dpi checkbox Enforce a resolution of 96 dpi factor text Zoom factor of the tiling area message-delay text Time messages are shown, in seconds new-tab-position-policy select @right @left @rightmost @leftmost Controls the position of newly created tabs +progress-bar-style select @default @simple The progress bar style +show-single-tab checkbox Whether to show the tabbar if only one tab is open scrollbars checkbox Whether scrollbars should be enabled -bars-padding text Padding of the status, download, completion and tab bars tabbar-visible text Number of seconds a hidden tabbar is visible when switching between tabs tabbed-browsing checkbox Whether to enable tabbed browsing user-stylesheet-uri text The uri of a stylesheet applied to every page widget-packing text Packing of the main widgets; t (T)=tabbar (hidden), w=webview, s (S)=statusbar (hidden), d=downloadbar -progress-bar-style select @default @simple The progress bar style # hints Hints hint-active-color text Color of active links in hintmode @@ -127,12 +128,12 @@ auto-insert-mode checkbox Whether to automatically go in insert mode if an edita cache-model select @webbrowser @documentviewer The cache-model used by webkit close-last-tab-policy select @ignore @clear @close Behaviour when the last tab is closed custom-encoding text The custom encoding of the view -download-external-command text External application used for downloads download-directory text Default download directory +download-external-command text External application used for downloads download-no-confirm checkbox Whether to immediately start a download if download-directory is set download-use-external-program checkbox Whether to use an external download helper -editor text External editor used for inputs/textareas editable checkbox Whether content can be modified +editor text External editor used for inputs/textareas enable-caret-browsing checkbox Whether to enable caret browsing enable-default-context-menu checkbox Whether to enable the right click context menu enable-developer-extras checkbox Whether developer extensions should be enabled @@ -151,7 +152,7 @@ history-length text Length of the browsing history navigation-history-max Length of the navigation history print-backgrounds checkbox Whether background images should be printed scheme-handler Application or script that handles uris with schemes that cannot be handled by dwb +searchengine-submit-pattern text The pattern which will be replaced with the search terms sync-files select @all @cookies @history @session @cookies_history @cookies_session @history_session Files to sync, see also file-sync-interval tab-key-cycles-through-elements checkbox Tab cycles through elements in insert mode update-search-delay text Delay before updating search results in milliseconds -searchengine-submit-pattern text The pattern which will be replaced with the search terms |