From Nautilus, when I select several PDF documents and press Enter, they are all opened, but in an apparently random order. What is determining the order in which these documents are being opened? Is there a way to open them in the order they appear in Nautilus?The filenames are enumerated 1 to 7, and the dates of last change also follow that order. But when they're all opened, the window on top might be file 4, file 5 next, then file 2, file 7, etc.
Order of opening of documents in Nautilus
nautilus
They're open in parallel. nautilus will spawn as many processes (the order doesn't really matter here) and each of those processes will execute your PDF viewer with one of the files as arguments.All those PDF viewers will work independently, load shared libraries, open their own PDF files, connect to the X server and at some point ask the X server to display a Window. Which one will do that first you have no control on.To guarantee the order, you'd need cooperation from the Windows manager. You'd need nautilus to ask the Window manager to tell it when the window for the first PDF viewer has popped up before running the next one.Doing that reliably for any application is not easy. nautilus only knows the pid of the process it spawned to execute the PDF viewer. Not all applications tell the Window manager their pid, and if they do, it may very well be the pid of a child of the process spawned by nautilus (like in the case of a shell script), or it may very well not create a window at all...