5

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?

3 Answers 3

3

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, 2021 at 14:19
3

The workaround I found helpful is, when the document opens unmaximized, press Super+Up Arrow Key on your keyboard. This key combination maximizes the window.

2

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).

4
  • Looks like a great trick. Unfortunately it doesn't work (for me) on 22.04 (Wayland). This is a deployment that was upgraded from 21.10, which didn't suffer from this issue...
    – sxc731
    May 3, 2022 at 11:49
  • @sxc731 This is a bug in 22.04. The fix has been tested and should be released soon. See bugs.launchpad.net/ubuntu/+source/evince/+bug/1969896 Jun 26, 2022 at 2:05
  • worked for me, 22.04 Wayland
    – pierrely
    Oct 7, 2022 at 9:10
  • It doesn't work on Ubuntu 20.04 Oct 20, 2022 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .