@@ -7,11 +7,13 @@ use gpui::{
use persistence::IMAGE_VIEWER;
use ui::prelude::*;
+use file_icons::FileIcons;
use project::{Project, ProjectEntryId, ProjectPath};
+use settings::Settings;
use std::{ffi::OsStr, path::PathBuf};
use workspace::{
item::{Item, ProjectItem, SerializableItem, TabContentParams},
- ItemId, Pane, Workspace, WorkspaceId,
+ ItemId, ItemSettings, Pane, Workspace, WorkspaceId,
};
const IMAGE_VIEWER_KIND: &str = "ImageView";
@@ -85,6 +87,14 @@ impl Item for ImageView {
.into_any_element()
}
+ fn tab_icon(&self, cx: &WindowContext) -> Option<Icon> {
+ ItemSettings::get_global(cx)
+ .file_icons
+ .then(|| FileIcons::get_icon(self.path.as_path(), cx))
+ .flatten()
+ .map(|icon| Icon::from_path(icon))
+ }
+
fn clone_on_split(
&self,
_workspace_id: Option<WorkspaceId>,