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


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


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
Next Post »