Update scripting system.
This commit is contained in:
+11
-4
@@ -1,16 +1,23 @@
|
||||
let () =
|
||||
let startup_script =
|
||||
if Array.length Sys.argv <> 2 then None else Some Sys.argv.(1)
|
||||
if Array.length Sys.argv = 2 then Some Sys.argv.(1)
|
||||
else
|
||||
let default =
|
||||
Filename.concat (Sys.getenv "HOME") ".config/kutu/config.rb"
|
||||
in
|
||||
if Sys.file_exists default then Some default else None
|
||||
in
|
||||
|
||||
let state = Kutu.State.new_state in
|
||||
|
||||
print_endline "Started Kutu WM";
|
||||
|
||||
Bindings.Core.register_callbacks state;
|
||||
Mruby.Core.mrb_load_string state.mrb Mruby.Initial.initial_code;
|
||||
|
||||
(match startup_script with
|
||||
| None -> ()
|
||||
| Some s -> Mruby.Core.mrb_load_file state.mrb s);
|
||||
| Some s ->
|
||||
Mruby.Core.mrb_load_string state.mrb (Mruby.Initial.initial_code s)
|
||||
| None -> Mruby.Core.mrb_load_string state.mrb "");
|
||||
Mruby.Core.error_check state.mrb;
|
||||
|
||||
if Xcb.Connection.flush state.conn <= 0 then exit 1;
|
||||
|
||||
Reference in New Issue
Block a user