Skip to content

Feature: RofiBeats World-Level Rewrite & UI Polish#59

Open
Mr-Hasan-Hamid wants to merge 1 commit into
LinuxBeginnings:developmentfrom
Mr-Hasan-Hamid:feat-rofibeats-dev
Open

Feature: RofiBeats World-Level Rewrite & UI Polish#59
Mr-Hasan-Hamid wants to merge 1 commit into
LinuxBeginnings:developmentfrom
Mr-Hasan-Hamid:feat-rofibeats-dev

Conversation

@Mr-Hasan-Hamid
Copy link
Copy Markdown

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 playerctl and MPRIS (mpv-mpris). Now, when a track changes, the new URL is seamlessly loaded into the already-running mpv instance. 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-dlp to 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.

  • The Rofi menu now uses a clean 5x2 grid layout, displaying the actual thumbnails next to the song titles.
  • Your desktop "Now Playing" notifications (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.

Copilot AI review requested due to automatic review settings May 12, 2026 02:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to 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.sh to 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.

Comment on lines +208 to +210
trap 'error_handler $? $LINENO' ERR
trap 'cleanup_exit' EXIT INT TERM

Comment on lines +217 to +218
cleanup_exit() {
rm -f "$mpv_socket" 2>/dev/null || true
Comment on lines +339 to +343
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
Comment on lines +629 to +631
echo "<https://www.youtube.com/watch?v=${BASH_REMATCH>}"
elif [[ "$path" =~ youtu\.be/([^?&/]+) ]]; then
echo "<https://www.youtube.com/watch?v=${BASH_REMATCH>}"
Comment on lines +1498 to +1500
start_endfile_watcher() {
pgrep -f "endfile_watcher.*$$" >/dev/null && return 0

Comment on lines +1663 to +1667
case "$choice" in
"🔁 Autoplay"*)
AUTOPLAY=$((1 - AUTOPLAY))
notify_info "Autoplay: $([ $AUTOPLAY -eq 1 ] && echo 'Enabled' || echo 'Disabled')"
;;
Comment on lines +1776 to +1780
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"
Comment thread config/hypr/scripts/MediaCtrl.sh Outdated
Comment on lines +7 to +12
# 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 $?
Comment thread pr_hyprlock.md Outdated
Comment on lines +1 to +4
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.

@dwilliam62 dwilliam62 self-assigned this May 12, 2026
@dwilliam62 dwilliam62 added the enhancement New feature or request label May 12, 2026
@Mr-Hasan-Hamid Mr-Hasan-Hamid force-pushed the feat-rofibeats-dev branch 2 times, most recently from 4955e2e to e6d685d Compare May 12, 2026 03:39
@Mr-Hasan-Hamid
Copy link
Copy Markdown
Author

@dwilliam62 I saw the Copilot review and realized I had accidentally bundled the pr_hyprlock.md documentation file into the RofiBeats PR, and also accidentally overwritten the pristine Modules file with my personal Waybar config.

I have completely reset the branch to the pristine development state and surgically re-applied the RofiBeats logic.

This PR now ONLY contains:

  1. The RofiBeats.sh script update.
  2. The MediaCtrl.sh update to natively route hardware keys to the new RofiBeats CLI.
  3. The Waybar Modules edit to route mouse clicks to the RofiBeats CLI.
  4. The config-rofi-Beats.rasi theme update to support the 5x2 thumbnail view.

No extraneous files or broken defaults are included. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants