feat(app): wire the app icon into the GUI, waybar, and SDL window
screencast_icon/ holds the single source icon set; meson install ships the 256 px PNG into the hicolor theme for the GTK panel (themed icon name) and the waybar CSS, and a custom target embeds it as icon_png_data.h so the SDL receiver window sets it via SDL_SetWindowIcon with an optional SDL3_image dependency (built-in find_library, since no pkg-config file ships with it).
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate a C++ header that embeds an image file as a byte array.
|
||||
|
||||
Usage: icon_to_header.py INPUT_IMAGE OUTPUT_HEADER
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) != 3:
|
||||
print(f"usage: {sys.argv[0]} INPUT_IMAGE OUTPUT_HEADER", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
with open(sys.argv[1], "rb") as src:
|
||||
data = src.read()
|
||||
|
||||
words = ", ".join(f"0x{byte:02x}" for byte in data)
|
||||
header = f"""// GENERATED FILE - do not edit by hand.
|
||||
// Produced by scripts/icon_to_header.py from screencast_icon/screencast_256.png.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
namespace sc {{
|
||||
inline constexpr std::array<std::uint8_t, {len(data)}> app_icon_png = {{
|
||||
{words}
|
||||
}};
|
||||
}} // namespace sc
|
||||
"""
|
||||
with open(sys.argv[2], "w") as dst:
|
||||
dst.write(header)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user