On Ubuntu 20.04, when I open a pdf file directly from the archive manager when it is part of a zip file, the document viewer always displays that pdf file in a small window. I would like it to open by default in a maximized window. The document viewer is whatever is delivered by default in Ubuntu 20.04 fresh install. If I open the pdf from the Files manager (Nautilus) using the document viewer—NOT from the archive manager—then document viewer opens by default in a maximized window. Changing the window size of document viewer has no impact on the small, default window size when opening from archive manager. I though perhaps there would be a .desktop file that controls the behavior, but I cannot determine if this is so. Nor can I find any place where preferences for either of the two applications are set. Bottom line: how can I change the default window size to maximize when opening a pdf file using document viewer from within archive manager?
Evince appears to "remember" window sizes on a per file base. It is all very obscure and there is, frustratingly, little control on the window size.
Caveat The following options will act on all new Evince windows, not only those opened from an archive as asked.
Maximize using Devilspie
I use Devilspie2 to ensure that each Evince window (whether the PDF is in an archive or not) is maximized on opening. This is a little (and unfortunately old, unmaintained and poorly documented) daemon program. It watches when a new window is created. If the window matches a criterion (e.g. it is an Evince window), then it will apply the rule you defined for these types of windows (i.e., the window is maximized).
• You can install Devilspie2 with the command
sudo apt install devilspie2.
• You need to create a configuration file
~/.config/devilspie2/devilspie2.lua to define the rules.
This is my rule for Evince windows:
--Evince Document Viewer if (not string.match(get_window_property("_NET_WM_STATE"),"_NET_WM_STATE_SKIP_PAGER") and get_application_name() == "Document Viewer" and get_window_name() ~= "Open Document" and get_window_name() ~= "Print" and get_window_name() ~= "Save As…" and get_window_name() ~= "Properties") then maximize(); end
The match criterion is rather complicated. It ensures that open and save dialogs, and PDF annotations, are not matched: for example, you do not want a maximized yellow note when you open one.
The action is very simple: maximize the window.
• For this to be enabled when you login, add devilspie to your autostart program. I found I need some delay for it to work, so my autostart command reads:
sh -c "sleep 8 && devilspie2 &"
Full screen via Evince command line option
Unfortunately, Evince has no command line option to start it maximized. However, there is a command line option to start it full screen. If that would be acceptable, you could launch Evince with the
-f option. To achieve that, edit the
.desktop launcher for Evince.
The following two commands, executed in the terminal, work for me on Ubuntu 20.04 with Evince 3.36.10:
gsettings set org.gnome.Evince.Default window-ratio '(1920, 1080)' gsettings set org.gnome.Evince.Default sizing-mode 'fit-page'
In the place of
1920, 1080, put in your screen size. After the first launch of Evince after that, it rewrites that ratio to something else (that still works).