Added scrolling text to Mac player module and cleaned up functions
Initially, I did some work that added a small scrolling text effect to the playerctl plugin last year (#273). I revisited the plugin and decided to do some clean up on it. I decided to expose some more parameters to users such as defining the width of the plugin and also the scrolling speed.
Additionally, I love the new Macos player plugin (#343) and decided to also add a similar scrolling effect for users. I exposed the scrolling speed as a parameter for users that wish to have this option on. I believe that since both of these plugins have very similar functions, there should be a common function that can be used to get the scrolling characters on screen. This function was added to the utils.sh file.
Let me know if you have any questions or if there's something that needs to be fixed up!
๐ Walkthrough
Walkthrough
Adds horizontal text-scrolling to mac-player and playerctl scripts with a circular slice utility, exposes tmux options for enabling/tuning scrolling and remote-control button mappings, updates caching/output logic for animated frames, and documents the new configuration examples in CONFIG.md.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Documentationdocs/CONFIG.md |
Added examples and new tmux configuration options documenting scrolling and speed/width settings for mac-player and playerctl. |
mac-player scriptscripts/mac-player.sh |
Added scroll(); read @dracula-mac-player-scroll and @dracula-mac-player-scroll-speed; added remote button mapping options (@dracula-mac-player-remote-play-pause, @dracula-mac-player-remote-back, @dracula-mac-player-remote-next); updated caching/output path to support animated rendering; minor change to source quoting; bind/unbind remote controls. |
playerctl scriptscripts/playerctl.sh |
Removed slice_loop(); added scroll(str, width, speed) and replaced manual slicing loop with scroll calls; read @dracula-playerctl-scroll, @dracula-playerctl-width, and @dracula-playerctl-speed. |
Utilitiesscripts/utils.sh |
Added slice_text() for circular substring extraction used by scrolling implementations. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Widget as Widget Script\n(mac-player/playerctl)
participant Utils as utils.sh
User->>Widget: Widget invoked (tmux hook / timer)
Widget->>Widget: Read tmux options (scroll, width, speed, remote mappings)
alt Scrolling enabled
Widget->>Utils: call slice_text / iterate frames via scroll()
Utils-->>Widget: return frame substring
Widget->>User: print frame with CR update (animated)
else Scrolling disabled
Widget->>User: print cached / truncated text
end
opt Remote access enabled
User->>Widget: remote button press
Widget->>Widget: map & handle action (play/pause/next/back)
end
Estimated code review effort
๐ฏ 4 (Complex) | โฑ๏ธ ~45 minutes
Possibly related PRs
- dracula/tmux#355: Overlaps edits to
scripts/mac-player.sharound caching, update flow, and remote-control wiring. - dracula/tmux#343: Prior changes to mac-player/playerctl logic that this PR extends with scrolling and slice utilities.
Suggested reviewers
- Theoreticallyhugo
[!TIP]
๐ Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
๐ Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ก Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
๐ฅ Commits
Reviewing files that changed from the base of the PR and between 8057a9cc80e7d440fbe1d91ce5dff071a5098cf7 and a65d4d64573e7a0ff519b87f15ec39ab93e9d94a.
๐ Files selected for processing (1)
-
scripts/mac-player.sh(4 hunks)
๐ง Files skipped from review as they are similar to previous changes (1)
- scripts/mac-player.sh
โจ Finishing Touches
- [ ] ๐ Generate Docstrings
๐งช Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
๐ชง Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreor@coderabbit ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@iberniex (the author of #343) knows the mac player best, so i'd be happy if he could check this :D
i didn't think about the fact that merging @iberniex plugin improvements would mess with yours. i'm sorry for the merge conflicts.
Let me try it out :)
After he resolves the conflicts
All good! I'll fix the conflicts later today
@Theoreticallyhugo @iberniex I fixed the conflicts. Let me know if I'm missing something!
Thank you for the pointers! Let me know if that looks better :)
I'm sorry I've been unresponsive for so long. situation is this:
- If I don't have spotify installed, this script crashes, even though apple music is set/ configured
- If I remove the logic relating to spotify, it works with apple music
- If I install spotify, I suddenly get neither a crash, nor output, even though i have something running in it. same if spotify is installed, closed, and apple music is running.
i will try to test this with the spotify logic removed soon