From 0a74f77fae860461ab77c40ab352d96c23c14638 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 8 Mar 2018 11:27:28 -0300 Subject: Support for specifiying session using environment variable LUAKIT_SESSION --- config.dot/luakit.link/rc.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3