Hiding the toolbar is not possible in evince either in Ubuntu 14.04 or 16.04, nor in upstream/vanilla evince (unmodified by Ubuntu), though if you're desperate, you can patch the source and recompile.
In vanilla evince, in full-screen mode, the toolbar autohides, which is somewhat helpful, if not entirely sufficient (semi-intelligent behaviour never does exactly what you desire, plus it would be very convenient to be able to hide the toolbar not in full-screen mode as well — arguably that is when the screen-space savings are particularly important).
Unfortunately, for evince as packaged in Ubuntu (14.04 and 16.04), even that is not possible. It seems that the (otherwise very useful) Ubuntu-specific patches returning a normal menu-bar and normal location of the toolbar, break the auto-hiding behaviour, exacerbating the problem.
Bug reports
The relevant bugs (ubuntu-specific and upstream) are here:
https://bugs.launchpad.net/ubuntu/+source/evince/+bug/1522527
https://bugs.launchpad.net/ubuntu/+source/evince/+bug/1409291
https://bugzilla.gnome.org/show_bug.cgi?id=714996
Patches
Working patches were provided (by Reinis Danne) in the GNOME bug report, but they were not accepted. Direct links for 3.12, the contemporary master branch and 3.14.
Luckily, these patches can still be manually applied (copy-pasting the code) to evince 3.18, as found in Ubuntu 16.04. Applying them directly with patch
appears not to work, probably due to slight changes in the surrounding code.
To get the source:
apt-get source evince
cd evince-3.18.2/
If this doesn't work, uncomment the deb-src
lines in /etc/apt/sources.list
.
Apply the following patch (adapted from the ones provided by Reinis Danne, linked above and provided here for completeness):
--- a/shell/ev-application.c 2018-01-02 23:00:00.502095551 +0100
+++ b/shell/ev-application.c 2018-01-03 23:15:00.713553169 +0100
@@ -1059,9 +1059,24 @@
}
static void
+app_toggle_toolbar_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ EvApplication *application = user_data;
+ EvWindow *window = EV_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
+ GActionMap *action_map = G_ACTION_MAP (window);
+ GAction *gaction = g_action_map_lookup_action (action_map, "toggle-toolbar");
+
+ g_action_activate (gaction, NULL);
+}
+
+
+static void
ev_application_startup (GApplication *gapplication)
{
const GActionEntry app_menu_actions[] = {
+ { "toggle-toolbar", app_toggle_toolbar_cb, NULL, NULL, NULL },
{ "new", app_new_cb, NULL, NULL, NULL },
{ "help", app_help_cb, NULL, NULL, NULL },
{ "about", app_about_cb, NULL, NULL, NULL }
@@ -1095,6 +1110,7 @@
"win.caret-navigation", "F7", NULL,
"win.zoom-in", "plus", "<Ctrl>plus", "KP_Add", "<Ctrl>KP_Add", "equal", "<Ctrl>equal", NULL,
"win.zoom-out", "minus", "<Ctrl>minus", "KP_Subtract", "<Ctrl>KP_Subtract", NULL,
+ "win.toggle-toolbar", "<Ctrl>H", NULL,
"win.show-side-pane", "F9", NULL,
"win.fullscreen", "F11", NULL,
"win.presentation", "F5", NULL,
--- a/shell/ev-window.c 2018-01-02 23:00:00.502095551 +0100
+++ b/shell/ev-window.c 2018-01-02 23:14:36.995706943 +0100
@@ -4907,6 +4907,27 @@
}
static void
+ev_window_view_cmd_toggle_toolbar (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ EvWindow *ev_window = user_data;
+ EvWindowPrivate *priv = ev_window->priv;
+
+ gboolean toolbar;
+ gboolean presentation;
+
+ presentation = EV_WINDOW_IS_PRESENTATION (ev_window);
+
+ toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
+ (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !presentation;
+
+ update_chrome_flag (ev_window, EV_CHROME_TOOLBAR, !toolbar);
+
+ set_widget_visibility (priv->toolbar, !toolbar);
+}
+
+static void
ev_window_view_cmd_toggle_sidebar (GSimpleAction *action,
GVariant *state,
gpointer user_data)
@@ -5697,6 +5718,7 @@
{ "continuous", NULL, NULL, "true", ev_window_cmd_continuous },
{ "dual-page", NULL, NULL, "false", ev_window_cmd_dual },
{ "dual-odd-left", NULL, NULL, "false", ev_window_cmd_dual_odd_pages_left },
+ { "toggle-toolbar", NULL, NULL, "true", ev_window_view_cmd_toggle_toolbar },
{ "show-side-pane", NULL, NULL, "false", ev_window_view_cmd_toggle_sidebar },
{ "inverted-colors", NULL, NULL, "false", ev_window_cmd_view_inverted_colors },
{ "fullscreen", NULL, NULL, "false", ev_window_cmd_view_fullscreen },
--- a/shell/evince-menus.ui 2018-01-02 23:00:00.502095551 +0100
+++ b/shell/evince-menus.ui 2018-01-03 23:16:02.969635772 +0100
@@ -21,6 +21,12 @@
<menu id="appmenu">
<section>
<item>
+ <attribute name="label" translatable="yes">_Toggle toolbar</attribute>
+ <attribute name="action">app.toggle-toolbar</attribute>
+ <attribute name="accel"><Primary>H</attribute>
+ </item>
+ </section> <section>
+ <item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new</attribute>
</item>
@@ -41,6 +47,10 @@
<menu id="view-menu">
<section>
<item>
+ <attribute name="label" translatable="yes">_Toolbar</attribute>
+ <attribute name="action">win.toggle-toolbar</attribute>
+ </item>
+ <item>
<attribute name="label" translatable="yes">_Continuous</attribute>
<attribute name="action">win.continuous</attribute>
</item>
with patch -p1 < name_of_patch_file.patch
or using quilt
(and ideally read the patch before/after applying it — it's actually quite comprehensible, especially in context).
Finally, compile evince with the standard ./configure; make; sudo make install
to install the patched evince to /usr/local/
. To install elsewhere, for example to avoid having to use sudo
, use ./configure --prefix=/full/path/to/alternative/location/
.
The patched evince will have the option of hiding the toolbar with Ctrl+h
. The menu-bar will not be hidden, which may or may not be what you want.
Hiding the menu-bar
In addition to the above patch, you would need to add:
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (ev_window), !toolbar);
to the end of the definition of ev_window_view_cmd_toggle_toolbar
in shell/ev-window.c
and change:
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), !presentation);
to:
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), !presentation && toolbar);
in the definition of update_chrome_visibility
, also in shell/ev-window.c
.
Security
I'd also recommend adding a /etc/apparmor.d/usr.local.bin.evince
apparmor profile based on usr.bin.evince
and subscribing to the Ubuntu security notices, since you won't be receiving security fixes to your version of evince. Alternatively, you might consider using something like apt-src
.