Avoid to restore window size when maximized (#226)

This commit is contained in:
redtide 2021-05-27 22:01:25 +02:00 committed by GitHub
parent bd29383a07
commit bd788d96fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -18,7 +18,7 @@ local core = {}
local function load_session()
local ok, t = pcall(dofile, USERDIR .. "/session.lua")
if ok then
return t.recents, t.window
return t.recents, t.window, t.window_mode
end
return {}
end
@ -29,6 +29,7 @@ local function save_session()
if fp then
fp:write("return {recents=", common.serialize(core.recent_projects),
", window=", common.serialize(table.pack(system.get_window_size())),
", window_mode=", common.serialize(system.get_window_mode()),
"}\n")
fp:close()
end
@ -370,9 +371,11 @@ function core.init()
end
do
local recent_projects, window_position = load_session()
if window_position then
local recent_projects, window_position, window_mode = load_session()
if window_mode == "normal" then
system.set_window_size(table.unpack(window_position))
else
system.set_window_mode("maximized")
end
core.recent_projects = recent_projects
end