local args, state = ... -- Set up views table local views = scroll.state_get_value(state, "views") if views == nil then scroll.state_set_value(state, "views", {}) views = scroll.state_get_value(state, "views") end local function find_view(view) for _, v in ipairs(views) do if v["object"] == view then return v end end return nil end if args[1] == 'toggle' then local focused_view = scroll.focused_view() local view = find_view(focused_view) if view == nil then view = { object = focused_view, maximized = false, wf = 0, hf = 0 } table.insert(views, view) end view["maximized"] = not view["maximized"] if view["maximized"] then local container = scroll.view_get_container(focused_view) view["wf"] = scroll.container_get_width_fraction(container) view["hf"] = scroll.container_get_height_fraction(container) scroll.command(nil, "set_size h 1.0") scroll.command(nil, "set_size v 1.0") else scroll.command(nil, "set_size h " .. view["wf"]) scroll.command(nil, "set_size v " .. view["hf"]) end end