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

insert new line and title when song changes using cmus daemon #22

Open
shadow-absorber opened this issue Oct 14, 2023 · 3 comments
Open

Comments

@shadow-absorber
Copy link

currently if you run clyrics in tmux the new lyrics gets kinda merged with the old lyrics when a new song starts/changes to a new song meaning it gets quickly confusing to find where the lyrics start and where it ends for songs

@mzivic7
Copy link

mzivic7 commented Feb 23, 2024

This will not insert newline and title, but just clear lyrics from previous song, as clyrics does outside tmux.

The problem is here:
reset -Q clears terminal but not tmux's buffer.
Tmux buffer is cleared with tmux clear-history but there also must be specified on what pane to clear
So the command becomes: tmux clear-history -t $TMUX_PANE
Now if tmux is not installed $TMUX_PANE variable will not exist, so to skip error messages:
if [ -z ${TMUX_PANE} ]; then :; else tmux clear-history -t $TMUX_PANE; fi

Finally this line should be changed to:
system('reset -Q; if [ -z ${TMUX_PANE} ]; then :; else tmux clear-history -t $TMUX_PANE; fi') == 0 or print "\e[H\e[J\e[H";

This command will patch clyrics script in /usr/bin:
sudo find /usr/bin/clyrics -type f -exec sed -i "s/system('reset -Q')/system('reset -Q; if [ -z \${TMUX_PANE} ]; then :; else tmux clear-history -t \$TMUX_PANE; fi')/g" {} \;

@shadow-absorber
Copy link
Author

thanks @mzivic7 this solves the problem decently for now... still would be nice to get a title output

@mzivic7
Copy link

mzivic7 commented Nov 23, 2024

@shadow-absorber
I made my own cmus-only lyrics display in python with ncurses, check it out if you want, its called cmus-auto-lyrics on github. It even scrolls lyrics automatically, and can read them from tags.

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