-
Notifications
You must be signed in to change notification settings - Fork 38
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
Is IPC really needed? #12
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The play-pause icons that are being changed are of the button generated by Polybar. Sure you can write a script to echo out the correct icon but you would have to do a lot more to make that work as a button. Polybar provides handy click handlers (see more here). Hence, to change the button text, we need to use their inter process messaging API. Feel free to ask more questions if you have. |
So, I was thinking about something like this: [module/playerctl-pp]
type = custom/script
tail = true
exec = dpolybar-player-status-pp
format = <label>
format-background = ${xrdb:color6}
format-foreground = ${xrdb:color0}
click-left = playerctl play-pause # dpolybar-player-status-pp
set -euo pipefail
function status_to_icon {
while read -r status; do
if [ "$status" = "Stopped" ]; then
echo <play-icon>
elif [ "$status" = "Paused" ]; then
echo <play-icon>
else
echo <pause-icon>
fi
done
}
playerctl status --follow 2>/dev/null | status_to_icon Do you see any significant differences? Btw, I'm using |
I see what you're trying to do. I'm also using this module along with |
I'm still learning my ways around polybar, so this is mostly exploratory work that I'm doing. One advantage I see in my approach is the fact that the bar name doesn't need to be replicated in the script, it's a simple one way relationship (bar calls script). On the other hand, your IPC solution may perform better but I haven't tested that yet. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Maybe I'm missing something, and if I am please enlighten me, but couldn't the play-pause behavior be implemented with a simple script component with an if statement?
The text was updated successfully, but these errors were encountered: