The way I'm doing it right now is inefficient:
To streamline things I'll need to stop using the usual settings file and instead load/save an app-specific settings file in on.load_settings and on.save_settings respectively.
VY24DRY6CZGUUURGPIYSL63HYTE22D573G5UX4MN55JORJ5GNW6AC
L2HMMGZPLQTMRPSHKIZZA77KOKKNVREUOWNSUKTIMS2GPMLJL4BAC
JIBCAKTUIYZ2NAAOXJ7YBM72XG7FZA2AQL64MZBJVM62ELU2BO4AC
LRDM35CEK3OHXOTB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC
FS2ITYYHBLFT66YUC3ENPFYI2HOYHOVEPQIN7NQR6KF5MEK4NKZAC
D4FEFHQCSILZFQ5VLWNXAIRZNUMCDNGJSM4UJ6T6FDMMIWYRYILQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
things will happen if you have _more than_ a single such app running.)
things will happen if you have _more than_ a single such app running. Or if
you close one app and open another without restarting the driver. Just always
open the app and then the driver. If you close the app, close the driver.)
{"on_handle":547,"text_input_on_manifest_navigator":634,"new_definition":681,"manifest_coord":636,"on_text":539,"on.mouse_press":617,"font":353,"add_thick_line":400,"A":507,"sx":544,"vx":545,"B":379,"on.key_release":552,"on":1,"mouse_cursor":558,"Mouse_cursor":559,"add_def_to_menu":640,"set_mouse_cursor":562,"Surface":422,"box_height":680,"compute_layout":385,"on.code_change":306,"order_of_magnitude":573,"approximate":579,"tick_spec":660,"update_editor_box":570,"approximate_up":658,"Ticks_font":669,"vy":546,"schema1_of_y":667,"Page":475,"on.save_settings":702,"on.load_settings":700,"scale":7,"initialize_editor":678,"Cursor_node":172,"table_and_array_both_empty":689,"manifest_index":637,"sy":469,"Menu_background_color":611,"line_height":365,"Menu_border_color":612,"manifest_navigator_candidates":638,"Menu_command_color":613,"on.keychord_press":666,"Menu_highlight_color":614,"on.initialize":695,"draw_menu_bar":641,"num_lines_for_manifest_navigator":676,"add_hotkey_to_menu":616,"Manifest_navigator":495,"draw_cursor":639,"draw_manifest_navigator":677,"fw_parent":705,"y_of_schema1":364,"fw_app":"driver","on.update":561,"reset_manifest_navigator":621,"Definitions":503,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on.draw":565,"get_definition_from_app":624,"load_definition":682,"copy_shape":396,"Manifest":494,"Viewport":604,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":706,"draw_ticks":663,"delete_definition":673,"on.text_input":521,"move_candidate_to_front_of_manifest":632,"on.mouse_release":554,"keychord_press_on_manifest_navigator":675}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app_name
end
{"manifest_navigator_candidates":638,"add_def_to_menu":640,"draw_cursor":639,"Manifest":494,"load_manifest":694,"get_manifest":705,"Definitions":503,"tick_spec":660,"new_definition":681,"update_editor_box":570,"load_definition":682,"maybe_update_key_in_definitions":529,"fw_parent":704,"fw_app":"driver","box_height":680,"schema1_of_y":667,"on.save_settings":702,"on.load_settings":700,"y_of_schema1":364,"on_handle":547,"Surface":422,"font":353,"on.mouse_press":617,"on.draw":565,"sx":544,"vx":545,"Viewport":604,"compute_layout":385,"vy":546,"on":1,"on.key_release":552,"Menu_background_color":611,"on.mouse_release":554,"Menu_border_color":612,"on.update":561,"Menu_command_color":613,"mouse_cursor":558,"copy_shape":396,"Mouse_cursor":559,"Cursor_node":172,"initialize_editor":678,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_menu_bar":641,"draw_ticks":663,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"B":379,"scale":7,"reset_manifest_navigator":621,"Menu_highlight_color":614,"on_text":539,"load_from_iterator":670,"order_of_magnitude":573,"get_definition_from_app":624,"on.initialize":695,"Manifest_navigator":495,"table_and_array_both_empty":689,"approximate":579,"manifest_navigator_up":628,"sy":469,"manifest_navigator_down":635,"on.keychord_press":666,"line_height":365,"delete_definition":673,"A":507,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":675,"Page":475,"text_input_on_manifest_navigator":634,"on.code_change":306,"Ticks_font":669,"manifest_coord":636,"on.text_input":521,"manifest_index":637,"add_thick_line":400}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
print('get manifest: app_name', value)
app_name = value
end
end
return result, app_name
end
{"maybe_update_key_in_definitions":529,"load_from_iterator":670,"schema1_of_y":667,"get_definition_from_app":624,"sy":469,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"on_handle":547,"Manifest_navigator":495,"initialize_editor":678,"on.initialize":695,"on_text":539,"manifest_index":637,"manifest_navigator_candidates":638,"on.update":561,"add_def_to_menu":640,"vx":545,"Manifest":494,"on.mouse_release":554,"load_manifest":694,"on.key_release":552,"get_manifest":704,"Definitions":503,"mouse_cursor":558,"new_definition":681,"compute_layout":385,"Cursor_node":172,"on.code_change":306,"set_mouse_cursor":562,"draw_ticks":663,"vy":546,"on.mouse_press":617,"order_of_magnitude":573,"load_definition":682,"on.keychord_press":666,"approximate":579,"Page":475,"A":507,"on.save_settings":702,"on.load_settings":700,"add_thick_line":400,"Ticks_font":669,"table_and_array_both_empty":689,"draw_cursor":639,"Viewport":604,"scale":7,"text_input_on_manifest_navigator":634,"sx":544,"approximate_up":658,"on.text_input":521,"font":353,"copy_shape":396,"line_height":365,"y_of_schema1":364,"box_height":680,"Surface":422,"Menu_background_color":611,"keychord_press_on_manifest_navigator":675,"Menu_border_color":612,"on.draw":565,"Menu_command_color":613,"update_editor_box":570,"Menu_highlight_color":614,"tick_spec":660,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"manifest_coord":636,"B":379,"draw_manifest_navigator":677,"on":1,"num_lines_for_manifest_navigator":676,"fw_app":"driver","fw_parent":703,"reset_manifest_navigator":621}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app_name
end
{"table_and_array_both_empty":689,"Ticks_font":669,"on.initialize":695,"B":379,"get_manifest":703,"load_manifest":694,"on.keychord_press":666,"on_handle":547,"on_text":539,"Surface":422,"vx":545,"vy":546,"Menu_background_color":611,"on.mouse_release":554,"Menu_border_color":612,"on.update":561,"Menu_command_color":613,"Page":475,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.mouse_press":617,"mouse_cursor":558,"draw_manifest_navigator":677,"Mouse_cursor":559,"num_lines_for_manifest_navigator":676,"set_mouse_cursor":562,"load_from_iterator":670,"update_editor_box":570,"get_definition_from_app":624,"manifest_navigator_down":635,"delete_definition":673,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"scale":7,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"sy":469,"add_def_to_menu":640,"Viewport":604,"draw_cursor":639,"Manifest_navigator":495,"fw_parent":702,"tick_spec":660,"fw_app":"driver","line_height":365,"on":1,"Manifest":494,"schema1_of_y":667,"draw_ticks":663,"new_definition":681,"maybe_update_key_in_definitions":529,"Definitions":503,"reset_manifest_navigator":621,"load_definition":682,"on.save_settings":702,"order_of_magnitude":573,"box_height":680,"compute_layout":385,"initialize_editor":678,"Cursor_node":172,"approximate":579,"add_thick_line":400,"y_of_schema1":364,"copy_shape":396,"font":353,"on.text_input":521,"on.code_change":306,"on.load_settings":700,"A":507,"approximate_up":658,"on.key_release":552,"sx":544,"Menu_highlight_color":614}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
print('get manifest: app_name', value)
app_name = value
end
end
return result, app
end
on.save_settings = function()
if Settings == nil then
Settings = {} -- just for initial schema migration
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
{"on.save_settings":702,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":701,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.save_settings = function()
if Settings == nil then
Settings = {}
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
{"on.save_settings":701,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":700,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on.save_settings":687,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":699,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.load_settings = function(settings)
App_name = load_manifest()
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on.save_settings":687,"on.load_settings":699,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":698,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.load_settings = function(settings)
App_name = load_manifest()
Viewport = settings[app_name].viewport
Definitions = settings[app_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on.save_settings":687,"on.load_settings":698,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":697,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.load_settings = function(settings)
local app_name = load_manifest()
Viewport = settings[app_name].viewport
Definitions = settings[app_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on.save_settings":687,"on.load_settings":697,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":696,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.load_settings = function(settings)
local app_name = load_manifest()
Viewport = settings.viewport
Definitions = settings.definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on.save_settings":687,"on.load_settings":696,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":695,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.initialize = function()
if table_and_array_both_empty(Definitions) then
new_definition()
end
A()
end
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":694,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":692,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":693,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
load_manifest = function()
-- Connect to an app and load its manifest into global Manifest.
-- Also return the name of the app we have connected to.
local new_manifest, app_name = get_manifest()
-- preserve existing order
-- 1. add new definitions in front
for _,name in ipairs(new_manifest) do
if not array.find(Manifest, name) then
table.insert(Manifest, 1, name)
end
end
-- 2. remove missing definitions
for idx=#Manifest,1,-1 do
local name = Manifest[idx]
if not array.find(new_manifest, name) then
table.remove(Manifest, idx)
end
end
return app_name
end
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":692,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":692,"Viewport":604,"load_manifest":496,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app
end