polybar / polybar-scripts

This is a community project. We write and collect scripts for polybar!
The Unlicense
2.49k stars 340 forks source link

x #139

Closed ghost closed 5 years ago

x70b1 commented 5 years ago

I dont have moc installed at the moment. But I guess if you look at mocp -Q %state and it returns stopped then you could adapt the script.

x70b1 commented 5 years ago

Yes, the interval should be short enough. If moc is paused you should only do something like echo "". So you module is empty.

x70b1 commented 5 years ago

What is the exact output of mocp -Q %state?

x70b1 commented 5 years ago

Try this:

#!/bin/sh

state=$(mocp -Q %state)

if [ "$state" != "STOP" ] || [ "$state" != "PAUSED" ];then
    SONG=$(mocp -Q %song)

    if [ -n "$SONG" ]; then
        echo "$SONG - $(mocp -Q %album)"
    else
        basename "$(mocp -Q %file)"
    fi
else
    echo ""
fi

You can change the values STOP and PAUSED, I dont know what tha output ofmocp is exactly.

x70b1 commented 5 years ago

Can you run the script on a terminal? What is the output?

x70b1 commented 5 years ago

You want it to disappear when there's no song playing? Do I understand that right?

x70b1 commented 5 years ago

Ah okay. So you problem is that you dont have a button to start it again because the button is away?

x70b1 commented 5 years ago

The script in the repo should disappear when mocp returns stopped. My script in this issue should disapper if mocp returns stopped or paused.

What is your interval value in your config of your polybar module?

x70b1 commented 5 years ago

I dont have a moc here, so i cant test much.

But you could take a look what moc returns wit mocp -Q %state. This should be the same value like in that condition.

x70b1 commented 5 years ago

At the moment I have no idea whats wrong here and I cant reproduce it.