formatting: reformat mixer.rs
This commit is contained in:
30
src/mixer.rs
30
src/mixer.rs
@@ -30,7 +30,9 @@ use crate::{
|
|||||||
instructions::MixerInstruction,
|
instructions::MixerInstruction,
|
||||||
playerctl::{playerctl_next, playerctl_play_pause, playerctl_previous},
|
playerctl::{playerctl_next, playerctl_play_pause, playerctl_previous},
|
||||||
pulseaudio::{PulseInstruction, SinkInputMixerData},
|
pulseaudio::{PulseInstruction, SinkInputMixerData},
|
||||||
utils::{get_sink_input_name, percentage_to_total_volume, send_notification, volume_to_percentage},
|
utils::{
|
||||||
|
get_sink_input_name, percentage_to_total_volume, send_notification, volume_to_percentage,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Mixer {
|
pub struct Mixer {
|
||||||
@@ -401,11 +403,18 @@ impl Mixer {
|
|||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.introspect()
|
.introspect()
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.set_sink_input_volume(*sink_index, &volume, Some(Box::new(move |success| {
|
.set_sink_input_volume(
|
||||||
|
*sink_index,
|
||||||
|
&volume,
|
||||||
|
Some(Box::new(move |success| {
|
||||||
if success {
|
if success {
|
||||||
let _ = send_notification(&format!("{sink_name}: {}%", volume_to_percentage(volume)));
|
let _ = send_notification(&format!(
|
||||||
|
"{sink_name}: {}%",
|
||||||
|
volume_to_percentage(volume)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
})));
|
})),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decrease_volume_current(&mut self) {
|
pub fn decrease_volume_current(&mut self) {
|
||||||
@@ -436,11 +445,18 @@ impl Mixer {
|
|||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.introspect()
|
.introspect()
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.set_sink_input_volume(*sink_index, &volume, Some(Box::new(move |success| {
|
.set_sink_input_volume(
|
||||||
|
*sink_index,
|
||||||
|
&volume,
|
||||||
|
Some(Box::new(move |success| {
|
||||||
if success {
|
if success {
|
||||||
let _ = send_notification(&format!("{sink_name}: {}%", volume_to_percentage(volume)));
|
let _ = send_notification(&format!(
|
||||||
|
"{sink_name}: {}%",
|
||||||
|
volume_to_percentage(volume)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
})));
|
})),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_current(&self) {
|
pub fn get_current(&self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user