Ubuntu: How to make evince open last document on startup?



Question:

Is there any way to make evince 3.10 automatically load last opened document on startup?


Solution:1

You can do it by writing a script to save Evince's state on system shutdown and reload on system startup. I'm not sure of a way to do it when just closing Evince though. I've been working on a similar solution based on other suggestions in similar questions which so far looks like this (but is not fully functional:

saving state

#!/usr/bin/awk -f  # Note: this won't work yet, just saved version from command line  # Need to adjust to work as stand alone script    # State can be restored with `$ { xargs -d "\n" -a ~/.openpdfs evince; } &`,  # but this is probably not the best option    BEGIN {       cmd = "lsof";       while ((cmd | getline) > 0)           if ($1=="evince"                                   \                  && /\/home\/.+\.[^. ]+$/                   \                  && !/\.(ttf|cache|log|i686-pc-linux-gnu)$/ \                  && sub(/^[^\/]+/, ""))                   print > "'$HOME'/.openpdfs";       close(cmd);   }  

restoring state

/usr/bin/xargs -d "\n" -a ~/.openpdfs /usr/bin/evince;  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »

1 comments:

Write comments
Unknown
AUTHOR
13 September 2017 at 01:29 delete

I suggest this post
https://www.howtogeek.com/203952/how-to-automatically-remember-running-applications-from-your-last-session-in-ubuntu-14.04/

Reply
avatar