From bd788d96fcd5a17f16bdcfd123ac7fe49ca5113f Mon Sep 17 00:00:00 2001 From: redtide Date: Thu, 27 May 2021 22:01:25 +0200 Subject: [PATCH] Avoid to restore window size when maximized (#226) --- data/core/init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 8d2edec7..6d6183c2 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -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