Skip to content

Commit

Permalink
feat: use svg icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 8, 2024
1 parent 7ff9e76 commit b66fc9d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions misc/launcher.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions misc/reset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 19 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use iced::widget::{button, container, image, row, slider, text, Space};
use iced::widget::{button, container, image, row, slider, svg, text, Space};
use iced::{executor, Event, Font};
use iced::{Command, Element, Length, Theme};
use iced_layershell::actions::{
Expand All @@ -20,6 +20,10 @@ mod zbus_mpirs;
type LaLaShellIdAction = LayershellCustomActionsWithIdAndInfo<LauncherInfo>;
type LalaShellAction = LayershellCustomActionsWithInfo<LauncherInfo>;

const LAUNCHER_SVG: &[u8] = include_bytes!("../misc/launcher.svg");

const RESET_SVG: &[u8] = include_bytes!("../misc/reset.svg");

pub fn main() -> Result<(), iced_layershell::Error> {
env_logger::builder().format_timestamp(None).init();

Expand Down Expand Up @@ -108,7 +112,14 @@ impl LalaMusicBar {
Space::with_width(Length::Fixed(10.)),
slider(0..=100, self.balance_percent(), Message::BalanceChanged),
Space::with_width(Length::Fixed(10.)),
button("R").on_press(Message::BalanceChanged(50)),
button(
svg(svg::Handle::from_memory(RESET_SVG))
.height(25.)
.width(25.)
)
.height(31.)
.width(31.)
.on_press(Message::BalanceChanged(50)),
Space::with_width(Length::Fixed(1.)),
button(">").on_press(Message::SliderIndexNext)
]
Expand Down Expand Up @@ -266,7 +277,12 @@ impl LalaMusicBar {
.spacing(10)
} else {
row![
button("L").on_press(Message::ToggleLauncher),
button(
svg(svg::Handle::from_memory(LAUNCHER_SVG))
.width(25.)
.height(25.)
)
.on_press(Message::ToggleLauncher),
title,
Space::with_width(Length::Fill),
buttons,
Expand Down

0 comments on commit b66fc9d

Please sign in to comment.