diff options
Diffstat (limited to 'src/component/icon.rs')
-rw-r--r-- | src/component/icon.rs | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/component/icon.rs b/src/component/icon.rs index 102c787..287c655 100644 --- a/src/component/icon.rs +++ b/src/component/icon.rs @@ -1,40 +1,28 @@ -use std::sync::Arc; - -use tokio::sync::{mpsc::Sender, Mutex}; use zbus::Connection; use crate::{ - dbus::{ - media_player2::MediaPlayer2Proxy, - player::{PlaybackStatus, PlayerProxy}, - playerctld::PlayerctldProxy, - }, + dbus::{media_player2::MediaPlayer2Proxy, player::PlaybackStatus, playerctld::PlayerctldProxy}, i3bar::{Block, Click}, Error, }; -use super::{Button, Component, Update}; +use super::{Button, Component}; pub struct Icon; impl Component for Icon { - const NAME: &'static str = "icon"; - type Updater = Self; + type Updater = (); type Colorer = PlaybackStatus; type Handler = Self; -} - -impl Update for Icon { - type Value = String; - async fn listen(tx: Sender<Self::Value>, _: PlayerProxy<'_>) -> Result<(), Error> { - tx.send(" ".into()).await.map_err(Into::into) - } - - async fn update(value: Self::Value, block: Arc<Mutex<Block>>) -> Result<bool, Error> { - let mut block = block.lock().await; - block.full_text = value; - Ok(true) + fn initialize() -> Block { + Block { + name: Some("mpris-icon".into()), + full_text: " ".into(), + separator: Some(false), + separator_block_width: Some(0), + ..Default::default() + } } } |