AndreasBackx / spotifatius

A simple Spotify CLI primarily made for monitoring what songs you're listening to and displaying that in your bar of choice like waybar or polybar.
MIT License
34 stars 6 forks source link

[enhancement] Icons for waybar #5

Closed thequantumcog closed 1 month ago

thequantumcog commented 1 year ago

Waybar does not support different icons for different states (for custom modules). So, can you add an option in config.toml to add a  (paused-icon) in json output

AndreasBackx commented 6 months ago

For some reason didn't see this earlier, my apologies. You should be able to do this in Waybar with its CSS. Otherwise, if you have any proposals for how it should be implemented, feel free to share.

thequantumcog commented 6 months ago

I have shifted to using a script, I no longer have this problem

dotaxis commented 4 months ago

I would also like this feature, I added it in my own local build like this:

diff --git a/src/commands/monitor.rs b/src/commands/monitor.rs
index 839491b..0daf3da 100644
--- a/src/commands/monitor.rs
+++ b/src/commands/monitor.rs
@@ -69,7 +69,11 @@ pub async fn run(opts: Monitor) -> Result<()> {
                     class.push(status.into());
                     let text = match (track.artist, track.title) {
                         (Some(artist), Some(title)) => {
-                            format!("{} {} {}", artist, separator, title)
+                            match status {
+                                TrackStatus::Playing => format!(" {} {} {}", artist, separator, title),
+                                TrackStatus::Paused => format!(" {} {} {}", artist, separator, title),
+                                _ => format!("{} {} {}", artist, separator, title),
+                            }
                         }
                         (Some(artist), None) => artist,
                         (None, Some(title)) => title,

Happy to open a PR if you'd like, but it would be even better to have some options in the config.toml to change waybar JSON output. For example, I personally prefer to switch the title and artist vars, so it would be good to not need to rebuild it just for a small change like this.

AndreasBackx commented 3 months ago

@dotaxis It should be more configurable. Some might not want an icon and some might want it in another place. Some polybar config for what it should output similar to what waybar has in its config might be good.

Though I think this is better left implemented by polybar itself in its script module: https://github.com/polybar/polybar/wiki/Module:-script. It would be nice if it had some implementation like waybar.

dotaxis commented 3 months ago

Yeah, I agree. I'll work on implementing some options in the config.toml and then I'll PR that.

AndreasBackx commented 1 month ago

Sorry it took me a while to push a new version, this should now be available in 0.2.6.