Skip to content
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

Can this scrolling-text package be implemented into (or used by) polybar somehow? #353

Closed
ghost opened this issue Jan 18, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Jan 18, 2017

zscroll (Link) is a text scroller for panels or the shell, and it's mostly used for scrolling song name from mpc or mpd. However, using custom script, I cannot implement it into polybar. The command to run the software is:
zscroll -d 0.2 -n -u -M "mpc status" -s 1 -m "paused" -s 0 "mpc current"
With the above command, the terminal will continuously output scrolling song name when mpc is playing and stop the scroll when mpc is paused. But when I create a custom script (with ~/.config/scripts/zscroll containing only the above command), like:

[module/mpc]
type = custom/script
exec = ~/.config/scripts/zscroll
tail = true
format-background = #999
format-foreground = #000

then add it to the modules list & restart the bar, nothing appears at all. Running:
/usr/bin/env sh -c ~/.config/scripts/zscroll
still executes normally with expected behavior in terminal. The error log shows nothing related to the custom script module at all.

So my question is: how can this be implemented into polybar using custom script? Or: [Feature Request] Could this be a new feature for the mpd module in the future?

Thank you for reading.

@ghost ghost changed the title Can this package be implemented into (or used by) polybar somehow? Can this scrolling-text package be implemented into (or used by) polybar somehow? Jan 18, 2017
@jaagr
Copy link
Member

jaagr commented Jan 18, 2017

Try this

script:

#!/bin/sh
if ! mpc >/dev/null 2>&1; then
  echo Server offline
  exit 1
elif mpc status | grep -q playing; then
  ( mpc current | zscroll -l 10 -d 0.1 -n ) &
else
  echo Not playing
fi
# Block until an event is emitted
mpc idle >/dev/null

module config:

[module/script]
type = custom/script
exec = ~/mpc_zscroll.sh
tail = true
interval = 0

@ghost
Copy link
Author

ghost commented Jan 18, 2017

Wow a much cleaner approach. Thank you so much! This could be included in the wiki if anyone prefers :)

@ghost ghost closed this as completed Jan 18, 2017
@noctuid
Copy link

noctuid commented May 9, 2017

For anyone else who stumbles across this, you can also keep the zscroll command as-is if you want or need to. I've added an example to the zscroll readme.

@jaagr
Copy link
Member

jaagr commented May 10, 2017

@noctuid nice. Couldn't it be simplified further by just using:

[module/mpd]
type = custom/script
exec = zscroll -n -u -b "♪ x" -d 0.3 -M "mpc status" -m "playing" -b "" -s 1 -m "paused" -b "" -s 0 "mpc current"
tail = true

@noctuid
Copy link

noctuid commented May 10, 2017

No, I couldn't find a way to get it working directly with exec =. I'd also rather not have a line that long in my config; is there some way to break lines?

@jaagr
Copy link
Member

jaagr commented May 10, 2017

No, it's not possible.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants