如何让evince在启动时打开最后一个文档?

有没有办法让evince 3.10在启动时自动加载上次打开的文件?

您可以通过编写脚本来保存Evince在系统关闭时的状态并在系统启动时重新加载。 虽然关闭Evince,但我不确定如何做到这一点。 我一直在研究一个类似的解决方案,基于类似问题的其他建议,到目前为止看起来像这样(但function不完全:

拯救国家

#!/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); } 

恢复国家

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