aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-03-08 11:27:28 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-03-08 11:27:28 -0300
commit0a74f77fae860461ab77c40ab352d96c23c14638 (patch)
tree119f2727c81c015c337abd3e8150601318f82760
parente2f1fe73ae6d5cf2446918022cac89cca8d57fbd (diff)
downloadluakit-0a74f77fae860461ab77c40ab352d96c23c14638.tar.gz
luakit-0a74f77fae860461ab77c40ab352d96c23c14638.tar.bz2
Support for specifiying session using environment variable LUAKIT_SESSION
-rw-r--r--config.dot/luakit.link/rc.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/config.dot/luakit.link/rc.lua b/config.dot/luakit.link/rc.lua
index 755e68e..dd054b8 100644
--- a/config.dot/luakit.link/rc.lua
+++ b/config.dot/luakit.link/rc.lua
@@ -186,6 +186,22 @@ local userprefs = require "userprefs"
-- -- Or open new window
-- window.new(uris)
--end
-window.new(uris)
+
+-- Session environment variable
+local luakit_session = os.getenv("LUAKIT_SESSION")
+
+-- Check if session was requested, otherwise open uris
+if luakit_session then
+ local path = basedir() .. "/luakit/sessions/"
+ local session = require "session"
+ local file = path .. luakit_session
+
+ if not lfs.attributes(path) then lfs.mkdir(path) end
+ session.session_file = file
+
+ session.restore(false)
+else
+ window.new(uris)
+end
-- vim: et:sw=4:ts=8:sts=4:tw=80