embed icons in build

This commit is contained in:
Bendik Aagaard Lynghaug
2026-03-20 15:29:06 +01:00
parent 95551cbd87
commit 8d837f5b25
17 changed files with 111 additions and 19 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ jobs:
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install gtk4 libadwaita pango opus pkg-config
brew install gtk4 libadwaita pango opus pkg-config glib
- name: Export brew paths for build tools (macOS)
if: runner.os == 'macOS'
+4
View File
@@ -24,4 +24,8 @@ serde.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
gio = "0.20"
hex = "0.4"
[build-dependencies]
glib-build-tools = "0.20"
+7
View File
@@ -0,0 +1,7 @@
fn main() {
glib_build_tools::compile_resources(
&["icons"],
"icons/icons.gresource.xml",
"icons.gresource",
);
}
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/net/zodia/app/icons">
<file>scalable/actions/weather-clear-symbolic.svg</file>
<file>scalable/actions/night-light-symbolic.svg</file>
<file>scalable/actions/system-users-symbolic.svg</file>
<file>scalable/actions/synastry-symbolic.svg</file>
<file>scalable/actions/go-next-symbolic.svg</file>
<file>scalable/actions/mail-unread-symbolic.svg</file>
<file>scalable/actions/call-start-symbolic.svg</file>
<file>scalable/actions/mail-send-symbolic.svg</file>
<file>scalable/actions/emblem-favorite-symbolic.svg</file>
</gresource>
</gresources>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor"
d="M3 1h3l1.5 4-2 1.5a8.5 8.5 0 0 0 4 4L11 8.5l4 1.5v3
a1.5 1.5 0 0 1-1.5 1.5C6.1 14.5 1.5 9.9 1.5 3A1.5 1.5 0 0 1 3 1z"/>
</svg>

After

Width:  |  Height:  |  Size: 292 B

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor"
d="M8 1.5l1.7 4.5H15l-4.3 3.1 1.7 5L8 11.5l-4.4 2.6 1.7-5L1 5.9h5.3z"/>
</svg>

After

Width:  |  Height:  |  Size: 234 B

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor" d="M6 3l5 5-5 5z"/>
</svg>

After

Width:  |  Height:  |  Size: 178 B

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor" d="M1 1.5l14 6.5-14 6.5V9.5l10-1.5-10-1.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 204 B

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<rect x="1" y="4.5" width="11" height="9" rx="1.5" fill="none"
stroke="currentColor" stroke-width="1.5"/>
<path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"
d="M1 6l5.5 4.5L12 6"/>
<!-- unread dot -->
<circle cx="13.5" cy="4" r="2" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 440 B

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor"
d="M13.5 10a6.5 6.5 0 1 1-7.5-7.5 5 5 0 0 0 7.5 7.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 218 B

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Two overlapping circles representing two astrological wheels compared -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<circle cx="5.5" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="1.5"/>
<circle cx="10.5" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 384 B

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<circle cx="5.5" cy="4.5" r="2.5" fill="currentColor"/>
<path fill="currentColor" d="M0.5 14c0-2.76 2.24-5 5-5s5 2.24 5 5z"/>
<circle cx="12" cy="4" r="2" fill="currentColor"/>
<path fill="currentColor" d="M9.5 14c0-2.2 1.1-4 3-4 1.93 0 3 1.8 3 4z"/>
</svg>

After

Width:  |  Height:  |  Size: 389 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<circle cx="8" cy="8" r="3" fill="currentColor"/>
<path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none"
d="M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2
M3.64 3.64l1.41 1.41M11.0 11.0l1.41 1.41
M12.36 3.64l-1.41 1.41M5.0 11.0l-1.41 1.41"/>
</svg>

After

Width:  |  Height:  |  Size: 409 B

+13
View File
@@ -54,6 +54,12 @@ fn main() {
Err(e) => tracing::warn!("baseline parse failed: {e}"),
}
// ── Bundled icons ─────────────────────────────────────────────────────────
// Register SVG icons compiled into the binary at build time so they render
// on all platforms (macOS has no system Adwaita icon theme).
gio::resources_register_include!("icons.gresource")
.expect("failed to register bundled icon resources");
// ── GTK / ADW application ─────────────────────────────────────────────────
let app = RelmApp::new("net.zodia.app");
@@ -61,6 +67,13 @@ fn main() {
// fallback if the compositor ignores prefer-dark-scheme.
adw::StyleManager::default().set_color_scheme(adw::ColorScheme::PreferDark);
// Add the bundled icon resource path to the default icon theme so GTK
// resolves our icons on every platform including macOS.
if let Some(display) = gtk4::gdk::Display::default() {
gtk4::IconTheme::for_display(&display)
.add_resource_path("/net/zodia/app/icons");
}
apply_css();
app.run_async::<AppModel>(AppInit { config, store });
}
+1 -1
View File
@@ -76,7 +76,7 @@ pub fn build_peer_page(
let syn_av = AspectView::new(synastry_items(&synastry), Rc::clone(&store), Rc::clone(&identity));
syn_av.widget().set_vexpand(true);
let syn_page = view_stack.add_titled(syn_av.widget(), Some("synastry"), "Synastry");
syn_page.set_icon_name(Some("system-users-symbolic"));
syn_page.set_icon_name(Some("synastry-symbolic"));
// Messages tab
let (messages_widget, msg_list) = build_messages_tab(peer_id, sender);
+7 -7
View File
@@ -41,13 +41,13 @@ impl AspectKind {
pub fn symbol(self) -> &'static str {
match self {
Self::Conjunction => "",
Self::SemiSextile => "",
Self::Sextile => "",
Self::Square => "",
Self::Trine => "",
Self::Quincunx => "",
Self::Opposition => "",
Self::Conjunction => "\u{FE0E}",
Self::SemiSextile => "\u{FE0E}",
Self::Sextile => "\u{FE0E}",
Self::Square => "\u{FE0E}",
Self::Trine => "\u{FE0E}",
Self::Quincunx => "\u{FE0E}",
Self::Opposition => "\u{FE0E}",
}
}
+10 -10
View File
@@ -33,16 +33,16 @@ impl Planet {
pub fn symbol(self) -> &'static str {
match self {
Planet::Sun => "",
Planet::Moon => "",
Planet::Mercury => "",
Planet::Venus => "",
Planet::Mars => "",
Planet::Jupiter => "",
Planet::Saturn => "",
Planet::Uranus => "",
Planet::Neptune => "",
Planet::Pluto => "",
Planet::Sun => "\u{FE0E}",
Planet::Moon => "\u{FE0E}",
Planet::Mercury => "\u{FE0E}",
Planet::Venus => "\u{FE0E}",
Planet::Mars => "\u{FE0E}",
Planet::Jupiter => "\u{FE0E}",
Planet::Saturn => "\u{FE0E}",
Planet::Uranus => "\u{FE0E}",
Planet::Neptune => "\u{FE0E}",
Planet::Pluto => "\u{FE0E}",
}
}