Skip to content

Commit

Permalink
fix: svg icons are working
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <[email protected]>
  • Loading branch information
ryanabx committed Aug 13, 2024
1 parent c63d645 commit e5f14ae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,21 @@ impl<'a> AppTrayApp<'a> {
let icon_path = freedesktop_icons::lookup(icon).with_cache().find();
println!("icon_path: {:?}", icon_path);
icon_path.map(move |path| {
iced::widget::button(
iced::widget::Image::new(path)
.content_fit(iced::ContentFit::Contain)
.width(Length::Fill)
.height(Length::Fill),
)
if path.extension().is_some_and(|x| x == "svg") {
iced::widget::button(
iced::widget::svg(path)
.content_fit(iced::ContentFit::Contain)
.width(Length::Fill)
.height(Length::Fill),
)
} else {
iced::widget::button(
iced::widget::image(path)
.content_fit(iced::ContentFit::Contain)
.width(Length::Fill)
.height(Length::Fill),
)
}
.width(Length::Fill)
.height(Length::Fill)
.padding(8)
Expand Down

0 comments on commit e5f14ae

Please sign in to comment.