update sidebar

This commit is contained in:
2026-08-30 17:30:45 +07:00
parent c61695e350
commit da9f5dfa83
9 changed files with 56 additions and 46 deletions
BIN
View File
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

+1 -22
View File
@@ -1,5 +1,5 @@
use anyhow::Context;
use gpui::{App, AssetSource, Result, SharedString};
use gpui::{AssetSource, Result, SharedString};
use gpui_component::IconNamed;
use rust_embed::RustEmbed;
@@ -33,17 +33,12 @@ impl AssetSource for Assets {
}
impl Assets {
/// Returns the embedded theme files as `(file name, JSON content)` pairs,
/// e.g. `("signed.json", ...)`. The content is a `ThemeSet` that can be
/// loaded into the [`ThemeRegistry`](gpui_component::ThemeRegistry).
pub fn themes(&self) -> Vec<(String, String)> {
Self::iter()
.filter(|path| path.starts_with("themes/"))
.filter_map(|path| {
let data = Self::get(path.as_ref())?;
let name = path.strip_prefix("themes/").unwrap_or(path.as_ref());
// Debug builds read files from disk (owned), release builds
// embed them in the binary (borrowed).
let content = match data.data {
std::borrow::Cow::Borrowed(bytes) => {
std::str::from_utf8(bytes).ok()?.to_owned()
@@ -54,22 +49,6 @@ impl Assets {
})
.collect()
}
pub fn load_fonts(&self, cx: &App) -> anyhow::Result<()> {
let font_paths = self.list("fonts")?;
let mut embedded_fonts = Vec::new();
for font_path in font_paths {
if font_path.ends_with(".ttf") {
let font_bytes = cx
.asset_source()
.load(&font_path)?
.expect("Assets should never return None");
embedded_fonts.push(font_bytes);
}
}
cx.text_system().add_fonts(embedded_fonts)
}
}
pub enum CustomIconName {