Feature: RofiBeats World-Level Rewrite & UI Polish#59
Conversation
There was a problem hiding this comment.
Pull request overview
This PR primarily refactors the RofiBeats music script into a much larger feature set (queue/history/favorites, YouTube search w/ thumbnails, IPC-based control, and media-key integration), and updates Waybar + notification integration to route playback controls through the new RofiBeats entrypoints.
Changes:
- Rewrote
RofiBeats.shto use mpv IPC for seamless track transitions, add YouTube auto-radio prefetching, and implement richer UI/controls (history, favorites, queue, downloads). - Updated Waybar MPRIS click actions and
MediaCtrl.shto call RofiBeats control flags (--next/--prev/--play-pause/--stop) and display cached thumbnails in notifications. - Tweaked the Rofi Beats Rasi theme for a more grid-like layout and thumbnail-friendly element styling; updated headers/attribution links in configs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pr_hyprlock.md | Adds Hyprlock-related writeup content (currently mismatched with PR’s RofiBeats-focused description). |
| config/waybar/Modules | Routes Waybar MPRIS click actions to RofiBeats control flags; adjusts clock formatting. |
| config/rofi/config-rofi-Beats.rasi | Updates RofiBeats UI layout/styling for thumbnails and a 2-column grid. |
| config/hypr/UserScripts/RofiBeats.sh | Large rewrite of the RofiBeats engine/UI, adds IPC control, caching, queue/history/favorites, downloads, autoplay logic, and CLI flags. |
| config/hypr/scripts/MediaCtrl.sh | Routes media controls through RofiBeats when mpv is detected and uses cached thumbnails for notifications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| trap 'error_handler $? $LINENO' ERR | ||
| trap 'cleanup_exit' EXIT INT TERM | ||
|
|
| cleanup_exit() { | ||
| rm -f "$mpv_socket" 2>/dev/null || true |
| pkill -x mpv 2>/dev/null || true | ||
| sleep 0.3 | ||
| pkill -9 -x mpv 2>/dev/null || true | ||
| sleep 0.3 | ||
| rm -f "$mpv_socket" 2>/dev/null || true |
| echo "<https://www.youtube.com/watch?v=${BASH_REMATCH>}" | ||
| elif [[ "$path" =~ youtu\.be/([^?&/]+) ]]; then | ||
| echo "<https://www.youtube.com/watch?v=${BASH_REMATCH>}" |
| start_endfile_watcher() { | ||
| pgrep -f "endfile_watcher.*$$" >/dev/null && return 0 | ||
|
|
| case "$choice" in | ||
| "🔁 Autoplay"*) | ||
| AUTOPLAY=$((1 - AUTOPLAY)) | ||
| notify_info "Autoplay: $([ $AUTOPLAY -eq 1 ] && echo 'Enabled' || echo 'Disabled')" | ||
| ;; |
| local required_tools=(rofi mpv yt-dlp socat notify-send jq) | ||
| for tool in "${required_tools[@]}"; do | ||
| if ! command -v "$tool" &>/dev/null; then | ||
| notify_error "Missing dependency: $tool" | ||
| log_error "Missing dependency: $tool" |
| # RofiBeats socket (deprecated, using pgrep instead for stability) | ||
| rofi_beats_script="$HOME/.config/hypr/UserScripts/RofiBeats.sh" | ||
|
|
||
| is_rofi_beats() { | ||
| pgrep -x "mpv" >/dev/null | ||
| return $? |
| Hey everyone! | ||
|
|
||
| I noticed there wasn't a quick way to change the lock screen wallpaper directly from the main keybinds, so I promoted the hidden `HyprlockWallpaperSelect.sh` script to be an official keybind. | ||
|
|
4955e2e to
e6d685d
Compare
|
@dwilliam62 I saw the Copilot review and realized I had accidentally bundled the I have completely reset the branch to the pristine This PR now ONLY contains:
No extraneous files or broken defaults are included. Thank you! |
e6d685d to
0035ecb
Compare
0035ecb to
b8b7f59
Compare
Hey everyone! I've been using RofiBeats heavily and noticed a few areas where we could really level up the experience to make it feel like a premium, native music app. I spent some time refactoring the engine to fix some underlying bugs and add a few highly-requested "Quality of Life" features.
Here is a breakdown of what this PR brings to the table:
1. Seamless Track Transitions
Previously, the script relied on an IPC socket to control
mpv. On some systems, this socket wouldn't create properly, leading to "Cannot skip" errors. Furthermore, skipping tracks meant killing the player and restarting it, causing a jarring gap in audio and annoying "Playback stopped" notification spam.The Fix: I've rewritten the core control logic to use standard
playerctland MPRIS (mpv-mpris). Now, when a track changes, the new URL is seamlessly loaded into the already-runningmpvinstance. The result is completely gapless audio transitions!2. Zero-Second "Auto-Radio" (Background Pre-fetching)
The YouTube Auto-Radio feature is awesome, but clicking "Next" used to mean waiting 15-30 seconds for
yt-dlpto calculate the next mix.The Fix: Now, the exact second a song starts playing, the engine silently pre-fetches the next related video in the background and caches it. When you press Next, the new song starts instantly with zero delay.
3. Visual Overhaul (Real Thumbnails!)
A music player needs album art. I've updated the YouTube search function to fetch high-quality video thumbnails.
MediaCtrl.sh) will also display the downloaded YouTube thumbnail instead of a generic music note.4. Global Hardware Media Key Support
Because the script now properly utilizes MPRIS, your physical keyboard media keys (Next, Previous, Play/Pause) and Waybar clicks will flawlessly control RofiBeats. Even better, pressing the physical "Next" key on your keyboard will actively trigger the smart YouTube Auto-Radio logic to find a related song, rather than just failing.
Note: Re-submitted against the development branch as requested.