Repository navigation
ALI-2358: MPRIS, so media controllers, playerctl and the screensaver work - #9
Merged
Merged
Conversation
New tokens for the player design on the Alias View canvas, for Mike to review before any player code is written: - spacing: controls-gap, cover-gap; - sizes: controls-height, control-icon, seek-track, seek-played, seek-thumb, volume-width, cover-art; - motion: controls-hide, seek-step; - scale: volume-step. The colours stay the seven theme roles. New contrast pairs: an icon on a hovered button (foreground on border, 3:1), the music view's artist line (muted on base, 4.5:1) and the seek bar's unplayed part (muted on panel, 3:1). They pass in every shipped theme and the built-in two.
- A video or song in the list opens in alias-playback's GPU helper: libmpv in a bubblewrap jail, drawing on the card the compositor uses (from linux-dmabuf feedback) and handing its frames over as dmabufs. They show in a subsurface above the window, so they never pass through this process. Sound goes through the session's PulseAudio socket, bound into the jail read-only. - The folder list takes videos and songs, so n, p, Page Up and Page Down move between them and pictures. - Space plays and pauses (after the end, plays from the start), Left and Right seek 5 s (seek-step), f toggles full screen and Escape leaves it. - While a file opens, the window says so; a file that can't play says why. - alias-playback is a git dependency on the branch of its PR #3 until #2 and #3 merge.
- The control bar from the design canvas, on an overlay subsurface above the video: Previous, Play (pause and replay icons), Next, the time, Position, Mute, Volume and Full screen, every target 44 px, with the focus ring and a border-coloured hover fill. The played part of a slider is thicker than the rest. - It hides 2 s after the last pointer move or key while a video plays, and stays while paused, ended, opening, for music, and while the keyboard focus is in it. - Keys from the canvas: Space and k, Left and Right seek, Up and Down volume, m, f and double-click, Home, t, Tab through the bar, and the media keys. - The music view: cover art at up to 320 px with rounded corners, or a panel with a note, and the title with "artist · album" under it. A song plays on to the next song in the folder and stops after the last. - AccessKit: named buttons, toggle buttons and sliders with values, and polite announcements for opening, play and pause, the end, failures, volume and seeks. - Tokens: time-pad, controls-group-gap, cover-icon, seek-announce and double-click, proposed with #6's. Lucide's ISC notice for the icons is in LICENSE.
…IFOs, full screen - A buffer the helper sends is checked before it reaches the compositor: its format and modifier must be one the compositor listed (dmabuf feedback's table, or v3's events) and its planes must fit in the dmabuf. A bad one was a protocol error that closed the window; now the file can't play and says why. - A buffer replaced while on screen is destroyed with the video layer if it's never let go. - A buffer the compositor lets go while still on screen goes back to the helper once the next frame replaces it; before, the slot was lost, and after three the video froze. - The frame on screen moves to the middle of the window when it changes size, even with no new frame coming (paused, ended, a song's cover). - A helper that dies mid-play takes its last frame with it, so the reason shows. - Session::failure ends the helper before waiting for it: the socket can fail with the helper still running, and the wait froze the window. - A path that isn't a regular file (a FIFO) is refused before it's opened, which waited for a writer. - Full screen carries from one video to the next, and ends for a song or a picture. - Left and Right change file when the file can't play, as for pictures.
…ay, Ctrl+C Merges ali-2358-player-video (its review round: buffer checks, re-centring, failures, FIFOs, full screen). Conflicts resolved to keep both: the player's keys stay in media_key, which now lets Left and Right change file when the file can't play. Review fixes for this PR: - The keyboard focus in the bar stays on the same control from file to file (Next pressed again goes on); close_media had reset it before it was read. - Announcements are said once: each goes in one of two alternating status nodes and is gone from the next tree, so the same words twice (t) are said again, and a stale one is never read back when a toast ends. - A position or volume report redraws only the bar on the overlay, not all of it. - Ctrl+C on a video or song offers the file only; it offered a PNG the picture decoders would have tried to make from the media file. - The music view's fallback line height comes from the type tokens.
# Conflicts: # src/app.rs
…kept - A file that can't play (a refused buffer, or the helper saying it can't) ends its helper, so no sound plays on under the reason, and frames that still arrive are given back, not shown. - A helper that closed its socket cleanly is waited for, not killed, so its exit code says why (libmpv missing, the sandbox not set up). Only after a read error is it ended first. - The format table comment says what the table is now used for.
…e bus off the loop - Play and Pause do what they say while a file opens (Play no longer toggled it to paused; Pause no longer did nothing), and Opening reads as Playing. - Seeked is sent for each real seek (keys, the slider, Seek, SetPosition, the screen reader) with where it went, not guessed from jumps in position. - Each property is signalled once and only when it changed: Metadata not on a pause, and CanSeek once. - Volume reads 0 while muted, and a Volume set is known at once, so its change signal carries the new value. - Seek past the end goes to the next track; SetPosition is ignored when stopped or past the end, as the spec says. - Next and Previous (and CanGoNext and CanGoPrevious) go to the next video or song, past pictures, going round. - A volume set or seek from a controller is announced as a key's would be. - The session bus is joined on a thread, so a slow bus never holds up the window; what MPRIS says is rebuilt only when it changed, with Position stored on each wake. - The zbus comment is back above its own line.
- Session::send waited for nothing: the socket is non-blocking (for reading), so a full one dropped the command, and a lost release left the helper a buffer short for good. A full socket is now waited on briefly. - Video is shown only where the compositor has viewporter, which places a frame at any window scale; without it the frame would be drawn at the wrong size.
… player keys in --help - Opening the grid closes the player; back from it, the same video or song picks up at the position it had, playing or paused as it was, instead of from the start. - The hover fill keeps the icon at 3:1 in any theme: a theme whose border is too close to its text gets a fill moved toward the panel until it passes (with a test). - The key-list fit test covers the player's list too, at 100%, 125% and 200%. - --help lists the player's keys, and the usage and folder messages say videos and songs.
# Conflicts: # src/player/mod.rs
…reset - alias-playback e11d5f4: #2's requests and reads that never wait, and #3's tags read with them (a song's cover played 12 of 12 times in the private weston, tags each time). - A helper whose socket ends in a reset rather than a clean close (it exited with commands unread) gets 100 ms to finish before it's ended, so its exit code still says why it stopped.
…me stays paused - The place kept for the file the grid closed was dropped only when another video or song opened, so after closing the grid onto a picture, the file could open much later at the old place. It now lasts only until the grid closes: onto that file it's used, onto any other it's dropped. - A file paused before the grid is asked to pause as it opens, so it no longer plays briefly from the start before the seek.
…se while opening - What MPRIS says is rebuilt when any tag changes, not only the first: tags arrive one by one, and the artist or album could go unsignalled. - On a seek, Position is stored before Seeked is sent, so a controller reading it then gets the new place. - A pause while a file opens is kept (it stays paused once loaded, and reads Paused), and Play or Play/Pause undoes it. - Seek past the end with no next track goes to the end. - A Volume set with nothing playing isn't stored. - Replay from the end sends Seeked to 0. - The file's URL is made from its bytes, so a name that isn't UTF-8 still names it. - The next and previous video or song are kept while the list and the place are the same, not looked for on every wake.
- A controller's requests are handled before the player syncs, so Next and Previous open the next file on the same turn, not on the next input. - Replay from the end shows the start at once, so the Position read on its Seeked is 0. - A file reopened paused after the grid is paused the way a controller's pause is, so it reads Paused while it opens and Play/Pause plays it. - A seek made before the bus joined isn't sent late; a SeekTo while a file opens isn't announced, as it can't happen.
…re confirmed by the loading file)
With no list (the table couldn't be read), any modifier was taken; now nothing is, so a buffer from the helper is never one the compositor hasn't said it takes.
So requests act on the file that's open (not one a key just left), a Next opens the next file on this turn, and MPRIS starts on the turn the first video or song opens.
michaelaguiar
marked this pull request as ready for review
December 2, 2026 22:43
main's tree is the same as ali-2358-player-video's c4eeb7d, which this branch already merged, so the branch's side is kept as it is.
Mike approved the player's tokens on 2026-12-02 (the ones from #6, and time-pad, controls-group-gap, cover-icon, seek-announce and double-click added after it). Their usage notes, the player's contrast pairs, and the player clauses on border, muted and accent now read as plain fact. src/tokens.rs regenerated with design/build.
Mike's decision of 2026-12-02: once the bar hides by itself over a playing video, the pointer hides with it, and whatever brings the bar back (any pointer motion, a key, a pause) brings the pointer back with the shape it would have. Music, a paused or ended video, and keyboard focus in the bar never hide it, as they never hide the bar. The pointer is hidden with wl_pointer.set_cursor and no surface, at the serial of the last enter, and kept hidden when it enters the window again. Only where cursor-shape-v1 is offered: without it the shape can't be set again, so the pointer is never hidden there.
…8-player-mpris # Conflicts: # src/app/player_ui.rs
The pointer comes back with the bar on a key, a click or a pause as well as on pointer motion, and hides only where cursor-shape-v1 is offered. Review round 5 on #8.
The jailed GPU helper's branch (ali-2358-gpu-media) merged as fef4a47, with the same code as the 4a05f2c this was pinned to.
…8-mpris-merge-work
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of ALI-2358: Alias View plays video and music. This is the last of the stack: #6 (tokens) ← #7 (playback) ← #8 (player UI) ← this.
This PR adds MPRIS. The ticket needs it "so the bar's media controls and playerctl work. The screensaver's PiP pause relies on this," and the canvas's keys board says the same: play, pause, next, previous and position.
What changes
src/mpris.rsservesorg.mpris.MediaPlayer2andorg.mpris.MediaPlayer2.Playerasorg.mpris.MediaPlayer2.alias_view.instance<pid>, using zbus 5.19. accesskit_unix already builds that version with the same async-io executor;blocking-apionly adds the blocking wrappers, so the build gains no new crate. It starts when the first video or song opens, never for pictures alone, and only with a session bus. It joins the bus on its own thread, so a slow bus never holds up the window.mpris:trackid(a new track per file),mpris:lengthin µs,xesam:title(the tag, or the file name),xesam:artist,xesam:album, andxesam:url, percent-encoded from the path's bytes.Security
MPRIS exposes control only: play, pause, seek, volume, next, previous and quit. OpenUri does nothing and no URI schemes are listed, so a bus client can't make Alias View open anything.
Checks
cargo +1.100 clippy --all-targets -D warningsis clean, and 134 tests pass. New tests cover the metadata keys and types, the URL for names that aren't UTF-8, the Stopped metadata, and skipping pictures and going round.busctl:busctl monitor), and Seek past the end moving to the next song;Review
/review-loop ran four rounds with a fresh-context reviewer before this PR was opened:
Declined: