feat: add a controller-driven Subsonic player for SteamOS

Browses a Subsonic library and plays it through mpv, driven by a
gamepad or keyboard. The UI scales from the window's physical height
rather than the compositor's scale factor, so it keeps its proportions
on a Steam Deck and on a 4K TV, where other players open small or
scale badly.
This commit is contained in:
Ansho Rei
2026-11-04 01:17:29 +01:00
commit 4105554f68
14 changed files with 10825 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
slint::include_modules!();
mod app;
mod config;
mod devscript;
mod input;
mod player;
mod subsonic;
use std::time::Duration;
fn main() -> anyhow::Result<()> {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("remus=info")).init();
let dev_script = std::env::var("REMUS_DEV_SCRIPT").ok();
let windowed = std::env::args().any(|a| a == "--windowed") || std::env::var_os("REMUS_WINDOWED").is_some();
let rt = tokio::runtime::Builder::new_multi_thread()
.worker_threads(2)
.enable_all()
.build()?;
let ui = AppWindow::new()?;
app::install(&ui, rt.handle().clone());
input::spawn_gamepad(|action| {
let _ = slint::invoke_from_event_loop(move || app::with_app(move |app| app.action(action)));
});
// Kept alive until the event loop ends.
let fullscreen_retry = slint::Timer::default();
if !windowed {
ui.window().set_fullscreen(true);
// Compositors ignore the request until the window is mapped, and a
// tiling one (COSMIC) can take the window back right after granting
// it. Keep asking until fullscreen has held for a second, giving up
// after five. Then stop, so a later F11 to leave fullscreen sticks.
let weak = ui.as_weak();
let (mut ticks, mut held) = (0, 0);
fullscreen_retry.start(slint::TimerMode::Repeated, Duration::from_millis(100), move || {
let Some(ui) = weak.upgrade() else { return };
if ticks >= 50 || held >= 10 {
return;
}
ticks += 1;
if ui.window().is_fullscreen() {
held += 1;
return;
}
held = 0;
log::debug!("not fullscreen yet ({:?}), asking again", ui.window().size());
ui.window().set_fullscreen(false);
ui.window().set_fullscreen(true);
});
}
if let Some(script) = dev_script {
devscript::run(&ui, &script);
}
ui.run()?;
app::shutdown();
drop(rt);
Ok(())
}