1

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?

1

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.

1
  • I ended up adding the -f parameter to the .desktop file. Next, I opened a pdf file in that way pressed ESC and then resized the window. Then I removed the -f parameter. The next time I opened a pdf from an archive, it opened in that new size of window - something that was NOT happening previously. – Amblymoron Jan 15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.