-
Notifications
You must be signed in to change notification settings - Fork 0
aurora player
Relevant source files
The following files were used as context for generating this wiki page:
The aurora-player crate is the graphical user interface for the Aurora Music Player ecosystem. Built using the Slint UI framework and powered by the Tokio async runtime, it serves as a thin client that communicates with the aurora-daemon via Unix domain sockets.
The application follows a reactive architecture where the Rust backend manages asynchronous communication and state synchronization, while the Slint frontend handles rendering and user interaction.
-
main.rs: Entry point that initializes the Slint window and spawns the interface logic app/src/main.rs:8-19. -
interface.rs: The "bridge" layer handling IPC, event dispatching, and Slint callback implementations. -
ui/: Contains.slintfiles defining the visual layout and component hierarchy. -
assets/: Bundled resources including fonts and fallback images app/src/main.rs:6-6.
The application uses #[tokio::main] to manage the asynchronous bridge app/src/main.rs:8-8. Upon startup, it instantiates the AuroraPlayer Slint component and passes a weak handle to the interface module to begin the daemon handshake app/src/main.rs:11-13.
The UI is structured as a single-window application with AuroraPlayer.slint acting as the root container. It manages global state properties (like current song metadata, volume, and queue) and delegates specific views to child components.
UI Component Relationship
graph TD
subgraph "aurora-player (Rust)"
Main["main()"] --> Interface["interface.rs (Tokio Task)"]
Interface -->|Updates Properties| SlintRoot["AuroraPlayer (Slint Instance)"]
SlintRoot -->|Triggers Callbacks| Interface
end
subgraph "AuroraPlayer.slint (Root Layout)"
SlintRoot --> QV["QueueView"]
SlintRoot --> MV["MainView (Switchable)"]
SlintRoot --> PV["PlayerView (Transport)"]
SlintRoot --> NV["NowPlayingView"]
MV --> LV["LibraryView"]
MV --> SV["SearchView"]
MV --> PLV["PlaylistView"]
end
subgraph "External"
Interface <==>|Unix Socket| Daemon["aurora-daemon"]
end
Sources: app/src/main.rs:8-19, app/ui/AuroraPlayer.slint:1-14
The core logic resides in interface.rs. This module establishes a connection to the daemon's Unix socket and manages two primary data flows:
-
Outgoing Requests: Translating Slint callbacks (e.g.,
play(),seek(),add_to_playlist()) intoaurora-protocolRequest enums. -
Incoming Responses: Listening for
Status,Queue, orThemeupdates from the daemon and updating the Slint UI properties in real-time.
For details on socket handling and callback registration, see UI–Daemon Bridge (interface.rs).
Sources: app/src/main.rs:13-16, app/ui/AuroraPlayer.slint:21-52
The frontend is composed of several modular views and a shared library of custom widgets:
-
Navigation: Managed via the
Tabsenum, switching visibility between Library, Search, and Playlist views app/ui/AuroraPlayer.slint:83-83. -
Transport Controls: The
PlayerViewprovides play/pause, skip, shuffle, repeat, and volume sliders app/ui/AuroraPlayer.slint:6-6. -
Queue Management:
QueueViewhandles the active playback list, supporting drag-and-drop movement and removal app/ui/AuroraPlayer.slint:172-184. -
Custom Widgets:
CustomComp.slintprovides standardizedSongCard,ContextMenu, andSlidercomponents used throughout the app app/ui/AuroraPlayer.slint:2-2.
For details on the component hierarchy and event delegation, see Slint UI Components.
Sources: app/ui/AuroraPlayer.slint:1-14, app/ui/AuroraPlayer.slint:112-153
Aurora features a dynamic theming system and bundled assets to ensure a consistent experience across different environments.
Themes are defined in the daemon's config.toml and broadcast to the player via the IPC channel. The player receives these updates and applies them to the global Theme singleton in Slint, which controls colors for backgrounds, text, and accents across all components app/ui/AuroraPlayer.slint:11-11.
For details on theme hot-reloading and the color pipeline, see Theming System.
The player embeds its own assets using include_bytes! to remain portable.
-
Fonts:
Noto Sans JPfor general text andJetBrainsMono NFPfor iconography app/ui/AuroraPlayer.slint:15-16. -
Images: A default
placeholder.pngis used when album art is unavailable app/src/main.rs:6-6.
For details on asset embedding and the image pipeline, see Assets & Fonts.
Sources: app/ui/AuroraPlayer.slint:110-110, app/ui/AuroraPlayer.slint:56-56
The following diagram maps high-level user actions to the specific code entities in the player crate that handle them.
User Interaction Flow
sequenceDiagram
participant User
participant Slint as "AuroraPlayer.slint"
participant Interface as "interface.rs"
participant Proto as "aurora-protocol"
participant Daemon as "aurora-daemon"
User->>Slint: Clicks Play on SongCard
Slint->>Interface: trigger enqueue(song_id)
Note over Interface: slint_handle.on_enqueue(...)
Interface->>Proto: Request::Enqueue(id)
Proto->>Daemon: JSON over Unix Socket
Daemon-->>Proto: Response::Status(State)
Proto-->>Interface: parse_response()
Interface->>Slint: set_current_playing_id(id)
Slint-->>User: Update UI (Green Highlight)
Sources: app/ui/AuroraPlayer.slint:31-31, app/src/main.rs:13-13
Overview
aurora-daemon
- Background Service
- Startup & State Init
- Request Handlers & Dispatch
- Playback Engine & Audio
- Library Indexing & Watching
- Playlists, Liked & History
- Background Threads
aurora-protocol
aurora-player
Reference