Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
7991618d
Commit
7991618d
authored
Oct 05, 2015
by
Sidharth Kapur
Browse files
Implement tilde feature for statusbar as well
parent
1be84c6c
Changes
4
Show whitespace changes
Inline
Side-by-side
doc/man/zathurarc.5.rst
View file @
7991618d
...
...
@@ -863,6 +863,13 @@ Use basename of the file in the window title.
* Value type: Boolean
* Default value: false
window-title-home-tilde
^^^^^^^^^^^^^^^^^^^^^^^
Display a short version of the file path, which replaces $HOME with ~, in the window title.
* Value type: Boolean
* Default value: false
window-title-page
^^^^^^^^^^^^^^^^^
Display the page number in the window title.
...
...
@@ -877,6 +884,13 @@ Use basename of the file in the statusbar.
* Value type: Boolean
* Default value: false
statusbar-home-tilde
^^^^^^^^^^^^^^^^^^^^
Display a short version of the file path, which replaces $HOME with ~, in the statusbar.
* Value type: Boolean
* Default value: false
zoom-center
^^^^^^^^^^^
En/Disables horizontally centered zooming.
...
...
@@ -965,13 +979,6 @@ Define the background color of the selected element in index mode.
* Value type: String
* Default value: #9FBC00
window-title-home-tilde
^^^^^^^^^^^^^^^^^^^^^^^
Display a short version of the file path, which replaces $HOME with ~, in the window title.
* Value type: Boolean
* Default value: false
SEE ALSO
...
...
zathura/config.c
View file @
7991618d
...
...
@@ -229,6 +229,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add
(
gsession
,
"window-title-page"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Display the page number in the window title"
),
NULL
,
NULL
);
bool_value
=
false
;
girara_setting_add
(
gsession
,
"statusbar-basename"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Use basename of the file in the statusbar"
),
NULL
,
NULL
);
bool_value
=
false
;
girara_setting_add
(
gsession
,
"statusbar-home-tilde"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Use ~ instead of $HOME in the filename in the statusbar"
),
NULL
,
NULL
);
bool_value
=
true
;
girara_setting_add
(
gsession
,
"synctex"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Enable synctex support"
),
NULL
,
NULL
);
string_value
=
""
;
...
...
zathura/zathura.c
View file @
7991618d
...
...
@@ -547,13 +547,24 @@ document_info_open(gpointer data)
}
const
char
*
get_
window_title
_filename
(
zathura_t
*
zathura
,
const
char
*
file_path
)
get_
formatted
_filename
(
zathura_t
*
zathura
,
const
char
*
file_path
,
bool
statusbar
)
{
bool
basename_only
=
false
;
if
(
statusbar
)
{
girara_setting_get
(
zathura
->
ui
.
session
,
"window-title-basename"
,
&
basename_only
);
}
else
{
girara_setting_get
(
zathura
->
ui
.
session
,
"statusbar-basename"
,
&
basename_only
);
}
if
(
basename_only
==
false
)
{
bool
home_tilde
=
false
;
if
(
statusbar
)
{
girara_setting_get
(
zathura
->
ui
.
session
,
"statusbar-home-tilde"
,
&
home_tilde
);
}
else
{
girara_setting_get
(
zathura
->
ui
.
session
,
"window-title-home-tilde"
,
&
home_tilde
);
}
if
(
home_tilde
)
{
char
*
home
=
getenv
(
"HOME"
);
size_t
home_len
=
home
?
strlen
(
home
)
:
0
;
...
...
@@ -697,13 +708,8 @@ document_open(zathura_t* zathura, const char* path, const char* password,
zathura
->
bisect
.
end
=
number_of_pages
-
1
;
/* update statusbar */
bool
basename_only
=
false
;
girara_setting_get
(
zathura
->
ui
.
session
,
"statusbar-basename"
,
&
basename_only
);
if
(
basename_only
==
false
)
{
girara_statusbar_item_set_text
(
zathura
->
ui
.
session
,
zathura
->
ui
.
statusbar
.
file
,
file_path
);
}
else
{
girara_statusbar_item_set_text
(
zathura
->
ui
.
session
,
zathura
->
ui
.
statusbar
.
file
,
zathura_document_get_basename
(
document
));
}
girara_statusbar_item_set_text
(
zathura
->
ui
.
session
,
zathura
->
ui
.
statusbar
.
file
,
get_formatted_filename
(
zathura
,
file_path
,
true
));
/* install file monitor */
file_uri
=
g_filename_to_uri
(
file_path
,
NULL
,
NULL
);
...
...
@@ -870,7 +876,7 @@ document_open(zathura_t* zathura, const char* path, const char* password,
}
/* update title */
girara_set_window_title
(
zathura
->
ui
.
session
,
get_
window_title
_filename
(
zathura
,
file_path
));
girara_set_window_title
(
zathura
->
ui
.
session
,
get_
formatted
_filename
(
zathura
,
file_path
,
false
));
g_free
(
file_uri
);
...
...
@@ -1123,7 +1129,7 @@ statusbar_page_number_update(zathura_t* zathura)
if
(
page_number_in_window_title
==
true
)
{
char
*
title
=
g_strdup_printf
(
"%s %s"
,
get_
window_title
_filename
(
zathura
,
zathura_document_get_path
(
zathura
->
document
)),
get_
formatted
_filename
(
zathura
,
zathura_document_get_path
(
zathura
->
document
)
,
false
),
page_number_text
);
girara_set_window_title
(
zathura
->
ui
.
session
,
title
);
g_free
(
title
);
...
...
zathura/zathura.h
View file @
7991618d
...
...
@@ -278,7 +278,15 @@ void zathura_set_plugin_dir(zathura_t* zathura, const char* dir);
*/
void
zathura_set_argv
(
zathura_t
*
zathura
,
char
**
argv
);
const
char
*
get_window_title_filename
(
zathura_t
*
zathura
,
const
char
*
file_path
);
/**
* Returns the filename formatted according to the user config.
* Takes into account the basename setting and the home-tilde setting.
*
* @param zatura The zathura session
* @param file_path The filename to be formatted
* @param statusbar True if for statusbar, false if for window title
*/
const
char
*
get_formatted_filename
(
zathura_t
*
zathura
,
const
char
*
file_path
,
bool
statusbar
);
/**
* Opens a file
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment