Compare commits

..
4 Commits
Author SHA1 Message Date
Ansho Rei bce0d68442 feat: show a track's own cover on its album page row
A track whose cover is a different picture from the album's now shows
that cover in its row instead of the track number. Pictures are compared
decoded, since Navidrome gives every track its own cover id even when it
is the album's image. The number column is as wide as the cover, so rows
with and without one line up.
2026-11-04 22:09:32 +01:00
Ansho Rei d77316b5b7 fix: delete covers cached before they were kept per server
Since 0.8.0 covers are cached in a directory per server. The files that
earlier versions wrote straight into the cache root were never read
again and never removed. They are now deleted once on start, in the
background; the server directories are left alone.
2026-11-04 21:35:04 +01:00
Ansho Rei 5b678d4f1c docs: say where the version shows while the controls bar is hidden
The README said the version is on every screen. Since the controls bar
can be turned off, it moves to a Version row in Settings instead.
2026-11-04 21:33:46 +01:00
Ansho Rei a005c3207a fix: ignore the controller while another window is in front
remus reads the controller from the device, whichever window has focus,
so presses meant for a game in front also skipped tracks and paused in
remus. It now follows winit's focus events, through slint's
unstable-winit-030 feature since Slint does not expose window activation
itself, and drops controller presses while the window is not in front.
It assumes focus until told otherwise, so a window manager that never
reports focus keeps the controller working.
2026-11-04 20:51:33 +01:00
8 changed files with 143 additions and 8 deletions
+24
View File
@@ -2,6 +2,30 @@
One section per version, newest first.
## v0.8.7 (2026-11-04)
### Features
- On an album page, a track whose cover is a different picture from the album's shows its cover instead of its track number. Only servers that give tracks their own art, such as Navidrome, can show this; Nextcloud Music gives every track the album's cover.
## v0.8.6 (2026-11-04)
### Bug fixes
- Covers cached by versions before 0.8.0 are deleted on start. They were no longer used but stayed on disk.
## v0.8.5 (2026-11-04)
### Bug fixes
- The README says where the version is shown while the controls bar is hidden: in Settings, as a Version row.
## v0.8.4 (2026-11-04)
### Bug fixes
- While another app or a game is in front, the controller no longer also controls remus. Music keeps playing in the background, and media keys still work.
## v0.8.3 (2026-11-04)
### Bug fixes
Generated
+2 -1
View File
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "remus"
version = "0.8.3"
version = "0.8.7"
dependencies = [
"anyhow",
"directories",
@@ -4907,6 +4907,7 @@ dependencies = [
"const-field-offset",
"i-slint-backend-linuxkms",
"i-slint-backend-selector",
"i-slint-backend-winit",
"i-slint-common",
"i-slint-core",
"i-slint-core-macros",
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "remus"
version = "0.8.3"
version = "0.8.7"
edition = "2024"
license = "MIT"
@@ -18,7 +18,7 @@ md5 = "0.8.1"
reqwest = { version = "0.13.5", default-features = false, features = ["json", "rustls"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.154"
slint = "1.18.1"
slint = { version = "1.18.1", features = ["unstable-winit-030"] }
tokio = { version = "1.54.1", features = ["rt-multi-thread", "sync", "macros", "time"] }
toml = "1.1.8"
zbus = { version = "5.19.0", default-features = false, features = ["tokio"] }
+1 -1
View File
@@ -86,7 +86,7 @@ A scripted run starts fullscreen like a normal one, so it also checks that start
### Versions
Every finished ticket bumps the version, so a build on the Deck can be matched to what it contains. The running version is shown at the bottom left of every screen.
Every finished ticket bumps the version, so a build on the Deck can be matched to what it contains. The running version is shown at the bottom left of the controls bar. With Show controls bar turned off in Settings, it is listed as a Version row in Settings instead. The login screen always shows the bar.
- `make patch` for a bug fix, `make minor` for a feature, `make major` only when a breaking change has been decided.
- Before bumping, add a `## v<new> (<date>)` entry at the top of `CHANGELOG.md`, with `### Features` and `### Bug fixes` subsections (leave out an empty one), and commit it with the change. `make version` prints the current version.
@@ -20,6 +20,10 @@
</supports>
<content_rating type="oars-1.1"/>
<releases>
<release version="0.8.7" date="2026-11-04"/>
<release version="0.8.6" date="2026-11-04"/>
<release version="0.8.5" date="2026-11-04"/>
<release version="0.8.4" date="2026-11-04"/>
<release version="0.8.3" date="2026-11-04"/>
<release version="0.8.2" date="2026-11-04"/>
<release version="0.8.1" date="2026-11-04"/>
+95 -3
View File
@@ -5,7 +5,7 @@ use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::future::Future;
use std::num::NonZeroUsize;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::sync::Arc;
use std::time::{Duration, Instant};
@@ -289,6 +289,9 @@ pub struct App {
volume_save_timer: Timer,
/// Keyboard keys or the buttons of the controller used last.
prompts: Prompts,
/// Whether the window has focus. True until the windowing system says
/// otherwise, so a system that never says still gets controller input.
window_active: bool,
/// Decoded hint icons, so a selection move does not parse SVG again.
icons: RefCell<HashMap<(Prompts, Control), Vec<Image>>>,
settings: Settings,
@@ -327,6 +330,9 @@ impl App {
{
log::warn!("cover cache disabled, cannot create {}: {e}", d.display());
}
if let Some(d) = dir.clone() {
rt.spawn_blocking(move || remove_unkeyed_covers(&d));
}
let inhibitor = Inhibitor::spawn(&rt);
let mpris = Mpris::spawn(&rt, |c| {
let _ = slint::invoke_from_event_loop(move || with_app(move |app| app.mpris_command(c)));
@@ -383,6 +389,7 @@ impl App {
art_waiting: false,
flip_timer: Timer::default(),
prompts: Prompts::Keyboard,
window_active: true,
icons: RefCell::default(),
settings: config::load_settings(),
fade: Fade {
@@ -701,10 +708,30 @@ impl App {
/// A button pressed on a controller of this family.
pub fn pad_action(&mut self, a: Action, family: Family) {
// Meant for whatever is in front: a game, Steam, another app.
if !self.window_active {
return;
}
self.set_prompts(Prompts::Pad(family));
self.action(a);
}
/// The window gained or lost focus. Only the controller cares: keys only
/// arrive while it has focus anyway.
pub fn set_window_active(&mut self, active: bool) {
if active != self.window_active {
log::info!(
"window {}",
if active {
"in front, controller on"
} else {
"in the background, controller off"
}
);
self.window_active = active;
}
}
/// A controller connected (its family) or the last one disconnected.
pub fn pad_present(&mut self, family: Option<Family>) {
self.set_prompts(family.map_or(Prompts::Keyboard, Prompts::Pad));
@@ -1637,6 +1664,33 @@ impl App {
self.items_range = (lo, hi);
}
/// The album's cover id, on an album page.
fn album_cover_id(&self) -> Option<String> {
let page = self.current_page()?;
if !page.list || !matches!(page.source, Source::Album(_)) {
return None;
}
page.header.as_ref()?.cover.clone()
}
/// Whether a track's cover is a different picture from its album's, so its
/// row shows the cover instead of the track number. Compared by picture:
/// Navidrome gives every track its own cover id even when it is the album's
/// image. False until both are decoded at this size; the load of either
/// redraws the row.
fn own_picture(&mut self, track: Option<&str>, album: &str, px: u32) -> bool {
let Some(track) = track.filter(|t| *t != album) else {
return false;
};
// Starts the album cover's load at row size, which the header does not.
self.cover(album, px);
let print = |app: &mut App, id: &str| app.covers.prints.get(&(id.to_string(), px)).copied();
match (print(self, track), print(self, album)) {
(Some(t), Some(a)) => t != a,
_ => false,
}
}
fn playing_id(&self) -> Option<&str> {
self.current.and_then(|i| self.queue.get(i)).map(|s| s.id.as_str())
}
@@ -1648,7 +1702,11 @@ impl App {
Target::Song(i) => page.songs.get(i).map(|s| s.id.as_str()) == self.playing_id(),
_ => false,
};
let album_cover = self.album_cover_id();
let cover = entry.cover.as_deref().and_then(|id| self.cover(id, px));
let show_art = entry.show_art
|| matches!(entry.target, Target::Song(_))
&& album_cover.is_some_and(|album| self.own_picture(entry.cover.as_deref(), &album, px));
let level = match entry.target {
Target::Setting(Setting::CoverBackdrop) => Some(self.settings.cover_backdrop as f32 / 100.0),
_ => None,
@@ -1664,7 +1722,7 @@ impl App {
has_cover: cover.is_some(),
cover: cover.unwrap_or_default(),
round: entry.round,
show_art: entry.show_art,
show_art,
playing,
slider: level.is_some(),
level: level.unwrap_or_default(),
@@ -1899,9 +1957,11 @@ impl App {
// Refresh whatever shows this cover.
let (lo, hi) = self.items_range;
// Every track row of an album compares its picture with the album's.
let album = self.album_cover_id().as_deref() == Some(id);
let rows: Vec<usize> = match self.current_page() {
Some(p) => (lo..hi.min(p.entries.len()))
.filter(|&i| p.entries[i].cover.as_deref() == Some(id))
.filter(|&i| album || p.entries[i].cover.as_deref() == Some(id))
.collect(),
None => Vec::new(),
};
@@ -2771,6 +2831,22 @@ fn color(lab: Lab) -> Color {
Color::from_rgb_u8(r, g, b)
}
/// Deletes the covers that versions before 0.8.0 cached straight under
/// `root`. Covers now live in a directory per server, so files directly in
/// `root` are never read again.
fn remove_unkeyed_covers(root: &Path) {
let Ok(entries) = std::fs::read_dir(root) else { return };
let mut removed = 0;
for entry in entries.flatten() {
if entry.file_type().is_ok_and(|t| t.is_file()) && std::fs::remove_file(entry.path()).is_ok() {
removed += 1;
}
}
if removed > 0 {
log::info!("removed {removed} covers cached before covers were kept per server");
}
}
fn sanitize(id: &str) -> String {
id.chars()
.map(|c| {
@@ -2872,6 +2948,22 @@ fn join_dot<I: IntoIterator<Item = Option<String>>>(parts: I) -> String {
mod tests {
use super::*;
#[test]
fn unkeyed_covers_go_and_server_directories_stay() {
let root = std::env::temp_dir().join(format!("remus-covers-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&root);
let server = root.join("u_https___host");
std::fs::create_dir_all(&server).unwrap();
std::fs::write(root.join("al-1_600"), b"old").unwrap();
std::fs::write(server.join("al-1_600"), b"new").unwrap();
remove_unkeyed_covers(&root);
assert!(!root.join("al-1_600").exists());
assert!(server.join("al-1_600").exists());
let _ = std::fs::remove_dir_all(&root);
}
fn png(pixel: [u8; 3]) -> Vec<u8> {
let img = image::RgbImage::from_pixel(8, 8, image::Rgb(pixel));
let mut out = std::io::Cursor::new(Vec::new());
+12
View File
@@ -28,6 +28,18 @@ fn main() -> anyhow::Result<()> {
let ui = AppWindow::new()?;
ui.set_version(env!("CARGO_PKG_VERSION").into());
app::install(&ui, rt.handle().clone());
// The controller is read from the device, whichever window is in front, so
// the app needs to know when another one is, to leave the presses to it.
{
use slint::winit_030::{EventResult, WinitWindowAccessor, winit::event::WindowEvent};
ui.window().on_winit_window_event(|_, event| {
if let WindowEvent::Focused(focused) = *event {
log::debug!("window focused: {focused}");
app::with_app(move |app| app.set_window_active(focused));
}
EventResult::Propagate
});
}
input::spawn_gamepad(|ev| {
let _ = slint::invoke_from_event_loop(move || {
app::with_app(move |app| match ev {
+3 -1
View File
@@ -213,8 +213,10 @@ component Row inherits Rectangle {
round: root.item.round;
}
}
// As wide as the art, so a row with a cover and a row with a number
// line up, as on an album where some tracks have their own cover.
if !root.item.show-art: Text {
width: 34px * Theme.s;
width: 46px * Theme.s;
text: root.item.playing ? "▶" : root.item.number;
font-size: 15px * Theme.s;
color: root.item.playing ? Theme.highlight : Theme.faint;