-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Mute command #253
Add Mute command #253
Conversation
Signed-off-by: Bailey Kasin <[email protected]>
Hi @BKasin, thanks for the PR. Ideally, |
@aome510 I agree that that would be preferable, but am not sure how to best implement it. |
Yeah, it's kinda tricky. One way is to add a new field called spotify-player/spotify_player/src/state/player.rs Lines 5 to 15 in bc605a7
None is not mute and Some(previous_volume_percent) if is mute. Handling "mute toggle" command will involve updating that state and sending a PlayerRequest::Volume request.
|
Track the old volume as mute_state: u32, which is None if not currently muted. Signed-off-by: Bailey Kasin <[email protected]>
Thank you for the guidance, I definitely was over-complicating it mentally. |
Signed-off-by: Bailey Kasin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks.
It would be nice to also have UI for the mute functionality. Can you change
spotify-player/spotify_player/src/ui/playback.rs
Lines 182 to 188 in 05fbda6
format!( | |
"repeat: {} | shuffle: {} | volume: {}% | device: {}", | |
<&'static str>::from(playback.repeat_state), | |
playback.shuffle_state, | |
playback.volume.unwrap_or_default(), | |
playback.device_name, | |
), |
Maybe displayvolume: old_percent% (muted)
if muted or volume: current_percent%
if not.
Yeah, a little later today when I get home I'll do that. |
Signed-off-by: Bailey Kasin <[email protected]>
Thanks @BKasin, after testing the change locally, I thought that the command logic could be simplified a bit more and we also need to handle the case when user increases/decreases the volume on mute. I updated the PR according to implement the above changes in a3930ac |
Ah, yeah that is definitely a lot better. Thank you! |
Resolves #243.
Add the ability to immediately set volume to 0% as requested in #243. I bound it to _ since "Shift + -" made sense to me, as it's basically super volume decrease.