diff --git a/build.zig b/build.zig index 9cdce66..e8cf673 100644 --- a/build.zig +++ b/build.zig @@ -23,11 +23,16 @@ pub fn build(b: *Builder) void { "use debug allocator for testing", ) orelse false; exe.addBuildOption(bool, "debug_allocator", debug_allocator); - const weather_location = b.option( + var weather_location = b.option( []const u8, "weather_location", "weather_location", - ) orelse "\"\""; + ) orelse ""; + if (weather_location.len == 0) { + weather_location = "\"\""; + } else if (weather_location[0] != '"') { + weather_location = std.fmt.allocPrint(std.heap.page_allocator, "\"{}\"", .{weather_location}) catch "\"\""; + } exe.addBuildOption([]const u8, "weather_location", weather_location); diff --git a/src/main.zig b/src/main.zig index 369d6ca..34fc06d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -33,10 +33,10 @@ pub fn main() !void { //&Widget.init(&textWidget.New("owo", "potato")), // 4KiB //&Widget.init(&textWidget.New("uwu", "tomato")), // 4KiB &Widget.init(&cpuWidget.New(&br)), // 4.08KiB - //&Widget.init(&memoryWidget.New(&br)), // 4.08KiB - //&Widget.init(&weatherWidget.New(allocator, &br, @import("build_options").weather_location)), // 16.16KiB - //&Widget.init(&batteryWidget.New(allocator, &br)), // 12.11KiB - //&Widget.init(&timeWidget.New(allocator, &br)), // 32.46KiB + &Widget.init(&memoryWidget.New(&br)), // 4.08KiB + &Widget.init(&weatherWidget.New(allocator, &br, @import("build_options").weather_location)), // 16.16KiB + &Widget.init(&batteryWidget.New(allocator, &br)), // 12.11KiB + &Widget.init(&timeWidget.New(allocator, &br)), // 32.46KiB }; bar.widgets = widgets[0..]; try br.start();