Add option to use basename in window title (Closes: #229)

This commit is contained in:
Sebastian Ramacher 2012-07-02 14:13:13 +02:00
parent c89aeef931
commit 6b41759cbb
3 changed files with 21 additions and 4 deletions

View file

@ -152,6 +152,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
bool_value = true;
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the window title"), NULL, NULL);
/* define default shortcuts */
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);

View file

@ -656,7 +656,15 @@ document_open(zathura_t* zathura, const char* path, const char* password)
zathura_bookmarks_load(zathura, file_path);
/* update title */
girara_set_window_title(zathura->ui.session, file_path);
bool basename_only = false;
girara_setting_get(zathura->ui.session, "window-title-basename", &basename_only);
if (basename_only == false) {
girara_set_window_title(zathura->ui.session, file_path);
} else {
char* tmp = g_path_get_basename(file_path);
girara_set_window_title(zathura->ui.session, tmp);
g_free(tmp);
}
g_free(file_uri);

View file

@ -581,7 +581,7 @@ scroll-hstep
^^^^^^^^^^^^
Defines the horizontal step size of scrolling by calling the scroll command once
* Value-type: Float
* Value type: Float
* Default value: -1
scroll-step
@ -602,14 +602,21 @@ search-hadjust
^^^^^^^^^^^^^^
En/Disables horizontally centered search results
* Value-type: Boolean
* Value type: Boolean
* Default value: true
window-title-basename
^^^^^^^^^^^^^^^^^^^^^
Use basename of the file in the window title.
* Value type: Boolean
* Default value: false
zoom-center
^^^^^^^^^^^
En/Disables horizontally centered zooming
* Value-type: Bool
* Value type: Bool
* Default value: False
zoom-max