Skip to content

Commit

Permalink
Merge pull request #12 from l4l/pixmap-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
l4l authored Dec 19, 2020
2 parents 67d796c + 6d7fa41 commit 7782a09
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ fn traverse_icon_dirs(config: IconConfig) -> IconPaths {
traverse_dir(&mut icons, FALLBACK_THEME, config.icon_size);
}

let pixmap_dir = Path::new("/usr/share/pixmaps/");
if pixmap_dir.exists() {
for entry in read_dir(pixmap_dir) {
traverse_icon_dir(&mut icons, entry);
}
}

icons
}

Expand Down
30 changes: 20 additions & 10 deletions src/draw/list_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,28 @@ where

let fallback_icon = self.params.fallback_icon.as_ref().map(|i| i.as_image());
if let Some(icon) = item.icon.as_ref().or_else(|| fallback_icon.as_ref()) {
dt.draw_image_at(
x_offset,
y_offset - icon.height as f32,
&icon,
&DrawOptions::default(),
);
if icon.width == icon.height
&& icon.height == self.params.icon_size.map(|s| s as i32).unwrap_or(0)
{
dt.draw_image_at(
x_offset,
y_offset - icon_size,
&icon,
&DrawOptions::default(),
);
} else {
dt.draw_image_with_size_at(
icon_size,
icon_size,
x_offset,
y_offset - icon_size,
&icon,
&DrawOptions::default(),
);
}
}

let pos = Point::new(
x_offset + icon_size + self.params.icon_spacing,
y_offset - (entry_height - FONT_SIZE) / 2.0,
);
let pos = Point::new(x_offset + icon_size + self.params.icon_spacing, y_offset);
let color = if i + skip == self.selected_item {
self.params.selected_font_color
} else {
Expand Down

0 comments on commit 7782a09

Please sign in to comment.