ahrm / sioyek

Sioyek is a PDF viewer with a focus on textbooks and research papers
https://sioyek.info/
GNU General Public License v3.0
7.15k stars 236 forks source link

[Feature request] Opening multiple documents at once #513

Open nimr0d opened 1 year ago

nimr0d commented 1 year ago

It would be useful if sioyek could open multiple documents at once. i.e. sioyek doc1.pdf doc2.pdf ... should open multiple files. I might implement it myself if it is wanted.

ahrm commented 1 year ago

You can already do this. You can open a new window by executing new_window command or from the command line by passing --new-window option.

nimr0d commented 1 year ago

I tried this before posting the issue, but this doesn't seem to do anything for me. Only one document is opened (the first one in the list). I am not sure what I'm doing wrong here. Also, I don't necessarily want it to open multiple windows. I just want multiple files to be readily available.

Btw, the usage is not completely clear from the help message. It says "sioyek [options]", where I think it would be better if was something like sioyek [options] file1 file2 ...

ahrm commented 1 year ago

Only one document is opened (the first one in the list

You can't do

sioyek file1.pdf file2.pdf ...

You need to do this:

sioyek file1.pdf
sioyek file2.pdf --new-window
sioyek file3.pdf --new-window
HakonHarnes commented 11 months ago

This script allows you to pass arguments as file1.pdf file2.pdf to open multiple files @nimr0d.

#!/bin/sh

pdfs=()
options="--new-window"

for arg in "$@"
do
  if [[ "$arg" == *".pdf" ]]
  then
    pdfs+=("$arg")
  else
    options+=" ${arg}"
  fi
done

for pdf in "${pdfs[@]}"
do
  sioyek $options "$pdf" > /dev/null 2>&1
done