this post was submitted on 18 Nov 2023
5 points (100.0% liked)

KDE & Plasma users

2809 readers
13 users here now

KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE's software runs on GNU/Linux, BSD and other operating systems, including Windows.

founded 4 years ago
MODERATORS
 

This may help some folks who want to use Okular but also have their PDF files reopen between restarts. You can call saveokular.sh from cron and some other tricks so this is all seamless:

$ cat /usr/local/bin/openokular.sh

#!/bin/bash

Check if the file with paths exists

if [ ! -f ~/.okular_open_files.txt ]; then

echo "No saved PDF paths found."

exit 1

fi

Open PDFs in Okular

echo $1 >> ~/.okular_open_files.txt

sed -i '/^$/d' ~/.okular_open_files.txt

cat ~/.okular_open_files.txt | xargs -d '\n' /usr/bin/orig_okular &

$ cat /usr/local/bin/saveokular.sh

#!/bin/bash

if pid=$(ps -C orig_okular -o pid= | sed -e 's/\s//g') && [[ -n $pid ]]; then

ls -l /proc/"$pid"/fd | grep '.pdf' | awk -F ' -> ' '{print $2}' > ~/.okular_open_files.txt

fi

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here