Skip to content

Instantly share code, notes, and snippets.

@johntyree
Created August 7, 2012 13:45
Show Gist options
  • Save johntyree/3285450 to your computer and use it in GitHub Desktop.
Save johntyree/3285450 to your computer and use it in GitHub Desktop.
Automagically save current session with rc.lua.
function window.init_funcs.auto_session_save (w)
w.tabs:add_signal("page-removed", function ()
if not session.closing then
w:save_session()
end
end)
session.closing = false
session.old_close_win = w.close_win
w.close_win = function (w, force)
session.closing = true
session.old_close_win(w, force)
end
end
function webview.init_funcs.auto_session_save (view, w)
view:add_signal("property::uri", function ()
w:save_session()
end)
end
-- Save current window session helper
window.methods.save_session = function (w)
session.save({w,})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment