///| Standalone native MoonBit Wayland compositor entrypoint. ///| fn main { let args = @env.args() let mut socket_path = "/tmp/wayland-moon-0" let mut theme_path = "config/themes/moon-night.json" let width = 1280 let height = 720 let mut i = 1 while i < args.length() { let a = args[i] if a == "--socket" && i + 1 < args.length() { socket_path = args[i + 1] i = i + 2 } else if a == "--theme" && i + 1 < args.length() { theme_path = args[i + 1] i = i + 2 } else { i = i + 1 } } let raw_theme = @sys.read_file_bytes(theme_path) let theme = if raw_theme.length() > 0 { let sb = StringBuilder() for j = 0; j < raw_theme.length(); j = j + 1 { sb.write_char(Int::unsafe_to_char(raw_theme[j].to_int())) } @scene.ThemeTokens::from_json_string(sb.to_string()) } else { @scene.ThemeTokens::moon_night() } match @host.MoonPlasmaCompositor::new(socket_path, theme, width, height) { Some(comp) => { println("moon-plasma compositor listening on " + socket_path) while true { comp.step() @sys.sleep_ms(16) } } None => { println("failed to bind Wayland socket at " + socket_path) } } }