you have to add something like EXTL_EXPORT_AS(WRegion)  above the function
region_get_configuration in ioncore/saveload.c and then rebuild ion, but
when that's done, it works pretty good! i'm happy now :)

tester={}
local workspaces = ioncore.read_savefile('saved_workspaces') or {}

-- bind this function to a button with WGroupWS context to save the current
-- ws
function tester.save_ws(r)
   ws_def = r:get_configuration(r)
   ws_def["switchto"] = true
   ws_def["bottom_last_close"] = true
   workspaces[ ws_def["name"] ] = ws_def
   ioncore.write_savefile('saved_workspaces', workspaces)
end

function tester.query_load_ws(mplex)
   mod_query.query(mplex, "Load workspace:", "", tester.get_ws, 
                   mod_query.make_completor(tester.complete_saved_ws), 
"load_ws")
end

function tester.complete_saved_ws(s)
   ws_list = {}
   for i, _ in pairs(workspaces) do
      if string.find(i, s, 1, true) then
         table.insert(ws_list, i)
      end
   end
   return ws_list
end

function tester.get_ws(mplex, ws_name)
   WMPlex.attach_new(mplex:screen_of(), workspaces[ws_name])
end

Reply via email to