Compare commits

..
1 Commits
Author SHA1 Message Date
Ansho Rei d0f1b6c95a feat: add a Controls page and keep only contextual hints in the bar
Settings lists every button and key, grouped by where it works and drawn
for the controller in use or the keyboard. The controls bar drops what
works the same everywhere, such as Back, Play / Pause and Sections, so
the hints that depend on the selection are no longer pushed aside. The
login screen keeps all its hints, since Settings is out of reach there.

Bumps the version to 0.10.3.
2026-11-07 00:13:59 +01:00
7 changed files with 254 additions and 25 deletions
+7
View File
@@ -2,6 +2,13 @@
One section per version, newest first.
## v0.10.3 (2026-11-07)
### Features
- Settings has a Controls page listing every button and key, grouped by where it works, drawn for the controller in use or the keyboard.
- The controls bar shows only the controls that depend on the selection or the screen. Back, Play / Pause, Sections, Now playing, Search, Skip, Seek, Volume and Mute, and Select where it only opens something, are on the Controls page instead. The login screen is unchanged.
## v0.10.2 (2026-11-06)
### Bug fixes
Generated
+1 -1
View File
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "remus"
version = "0.10.2"
version = "0.10.3"
dependencies = [
"anyhow",
"directories",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "remus"
version = "0.10.2"
version = "0.10.3"
edition = "2024"
license = "MIT"
+2
View File
@@ -62,6 +62,8 @@ A bundle does not update itself. To update, install the next version's bundle th
| | F11 | Toggle fullscreen |
| | Ctrl+Q | Quit |
Settings has a Controls page with the same list, drawn with the buttons of the controller in use or the keyboard keys. The controls bar at the bottom shows only what depends on the selection, such as Add to queue on an album or Log out on a server. What works the same everywhere is left to the Controls page. The login screen shows all of its controls, since Settings cannot be reached from there.
With Steam running, remus listens only to Steam's virtual controller, so a pad Steam also exposes does not send every press twice. On a Deck, Steam + X opens the on-screen keyboard for the login and search fields.
## Development
@@ -20,6 +20,7 @@
</supports>
<content_rating type="oars-1.1"/>
<releases>
<release version="0.10.3" date="2026-11-07"/>
<release version="0.10.2" date="2026-11-06"/>
<release version="0.10.1" date="2026-11-06"/>
<release version="0.10.0" date="2026-11-06"/>
+227 -23
View File
@@ -131,6 +131,8 @@ enum Target {
/// Starts library shuffle.
ShuffleAll,
Setting(Setting),
/// A row of the Controls page, by index into `CONTROL_ROWS`.
ControlRow(usize),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -143,8 +145,122 @@ enum Setting {
/// A saved login, by index into `Logins::servers`.
Server(usize),
AddServer,
/// Opens the Controls page.
Controls,
}
/// What a row of the Controls page shows on its right.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Keys {
/// The control's icons, as the controls bar draws them.
Icons(Control),
/// Written out, for controls without icons: on a keyboard, then on a
/// controller. Empty where there is none.
Text(&'static str, &'static str),
}
struct ControlRow {
/// Where it works: the rows are listed in groups, in this order.
group: &'static str,
label: &'static str,
keys: Keys,
}
/// Every control, for the Controls page in Settings. The controls bar shows
/// only what depends on the selection; the rest is learned here.
const CONTROL_ROWS: &[ControlRow] = &[
ControlRow {
group: "Everywhere",
label: "Move",
keys: Keys::Text("Arrow keys", "D-pad or left stick"),
},
ControlRow {
group: "Everywhere",
label: "Select",
keys: Keys::Icons(Control::Activate),
},
ControlRow {
group: "Everywhere",
label: "Back",
keys: Keys::Icons(Control::Back),
},
ControlRow {
group: "Everywhere",
label: "Play / pause",
keys: Keys::Icons(Control::PlayPause),
},
ControlRow {
group: "Everywhere",
label: "Skip track",
keys: Keys::Icons(Control::Skip),
},
ControlRow {
group: "Everywhere",
label: "Seek 10 s",
keys: Keys::Text(", / .", "Right stick left / right"),
},
ControlRow {
group: "Everywhere",
label: "Volume",
keys: Keys::Icons(Control::Volume),
},
ControlRow {
group: "Everywhere",
label: "Mute",
keys: Keys::Icons(Control::Mute),
},
ControlRow {
group: "Everywhere",
label: "Now playing",
keys: Keys::Icons(Control::NowPlaying),
},
ControlRow {
group: "Everywhere",
label: "Search",
keys: Keys::Icons(Control::Search),
},
ControlRow {
group: "Browsing",
label: "Sections",
keys: Keys::Icons(Control::Sections),
},
ControlRow {
group: "Browsing",
label: "Add to queue",
keys: Keys::Icons(Control::Queue),
},
ControlRow {
group: "Browsing",
label: "Shuffle play",
keys: Keys::Icons(Control::ShufflePlay),
},
ControlRow {
group: "Now playing",
label: "Seek",
keys: Keys::Icons(Control::Seek),
},
ControlRow {
group: "Now playing",
label: "Shuffle mode",
keys: Keys::Icons(Control::Shuffle),
},
ControlRow {
group: "Text fields",
label: "Steam keyboard",
keys: Keys::Icons(Control::OnScreenKeyboard),
},
ControlRow {
group: "Window",
label: "Fullscreen",
keys: Keys::Text("F11", ""),
},
ControlRow {
group: "Window",
label: "Quit",
keys: Keys::Text("Ctrl + Q", ""),
},
];
/// What the server prompt in Settings offers.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Choice {
@@ -212,6 +328,8 @@ struct HeaderInfo {
#[derive(Clone, Debug)]
enum Source {
Section(Section),
/// The Controls page, opened from Settings.
Controls,
Album(String),
Artist(String),
Playlist(String),
@@ -999,6 +1117,13 @@ impl App {
if prompts != self.prompts {
self.prompts = prompts;
self.render_hints();
// Its rows show the buttons of the input in use.
if self
.current_page()
.is_some_and(|p| matches!(p.source, Source::Controls))
{
self.sync_items(true);
}
}
}
@@ -1406,6 +1531,7 @@ impl App {
}
Target::ShuffleAll => self.start_library_shuffle(),
Target::Setting(s) => self.toggle_setting(s),
Target::ControlRow(_) => {}
}
}
@@ -1434,12 +1560,22 @@ impl App {
Setting::ShowHintBar => self.settings.show_hint_bar = !self.settings.show_hint_bar,
Setting::Server(i) => return self.select_server(i),
Setting::AddServer => return self.add_server(),
Setting::Controls => return self.open_controls(),
// A range: left and right change it, confirm does nothing.
Setting::CoverBackdrop | Setting::Version => return,
}
self.settings_changed();
}
/// The Controls page, on top of Settings. No header: it is a list.
fn open_controls(&mut self) {
let page = self.new_page(Source::Controls, "Controls".to_string(), true, None);
let id = page.id;
self.stacks[self.section].push(page);
self.load(id, Source::Controls);
self.render_page();
}
/// Moves a range setting one step up or down.
fn adjust_setting(&mut self, setting: Setting, up: bool) {
match setting {
@@ -1454,7 +1590,8 @@ impl App {
| Setting::ShowHintBar
| Setting::Version
| Setting::Server(_)
| Setting::AddServer => return,
| Setting::AddServer
| Setting::Controls => return,
}
self.settings_changed();
}
@@ -1660,6 +1797,10 @@ impl App {
self.page_loaded(page_id, Ok(data), true);
return;
}
if matches!(source, Source::Controls) {
self.page_loaded(page_id, Ok(controls_data()), true);
return;
}
let Some(client) = self.client.clone() else { return };
match source {
Source::Section(Section::Recent) => self.spawn(
@@ -1713,7 +1854,7 @@ impl App {
async move { Ok(playlists_data(client.playlists().await?)) },
move |app, r| app.page_loaded(page_id, r, true),
),
Source::Section(Section::Search | Section::Settings) => {}
Source::Section(Section::Search | Section::Settings) | Source::Controls => {}
Source::Search(q) => self.spawn(
async move { Ok(search_data(client.search(&q).await?)) },
move |app, r| app.page_loaded(page_id, r, true),
@@ -2012,13 +2153,17 @@ impl App {
Target::Setting(Setting::CoverBackdrop) => Some(self.settings.cover_backdrop as f32 / 100.0),
_ => None,
};
let (icons, detail) = match entry.target {
Target::ControlRow(i) => self.control_keys(&CONTROL_ROWS[i]),
_ => (Vec::new(), entry.detail),
};
Some(Item {
index: index as i32,
letter: initial(&entry.title).into(),
tint: tint(&entry.title),
title: entry.title.into(),
subtitle: entry.subtitle.into(),
detail: entry.detail.into(),
detail: detail.into(),
number: entry.number.into(),
has_cover: cover.is_some(),
cover: cover.unwrap_or_default(),
@@ -2027,9 +2172,26 @@ impl App {
playing,
slider: level.is_some(),
level: level.unwrap_or_default(),
icons: ModelRc::new(VecModel::from(icons)),
})
}
/// A Controls row's icons for the input in use, or its keys written out,
/// or which input it needs when this one has nothing for it.
fn control_keys(&self, row: &ControlRow) -> (Vec<Image>, String) {
let keyboard = self.prompts == Prompts::Keyboard;
let (icons, text) = match row.keys {
Keys::Icons(c) => (self.hint_icons(c), ""),
Keys::Text(k, p) => (Vec::new(), if keyboard { k } else { p }),
};
let text = match text {
"" if icons.is_empty() && keyboard => "Controller only",
"" if icons.is_empty() => "Keyboard only",
t => t,
};
(icons, text.to_string())
}
fn render_shuffle(&self) {
let label = match self.shuffle {
_ if self.library.is_some() => "Shuffling the whole library",
@@ -2078,15 +2240,12 @@ impl App {
}
}
Screen::Browse => match self.area {
Area::Sidebar => {
h(Control::Activate, "Open");
h(Control::PlayPause, "Play / Pause");
h(Control::Search, "Search");
h(Control::NowPlaying, "Now playing");
}
// What works the same everywhere (Back, Play / Pause,
// Sections, Now playing, Search, and Activate where it opens)
// is on the Controls page in Settings instead.
Area::Sidebar => {}
Area::Search => {
h(Control::Activate, "Search");
h(Control::Back, "Back");
h(Control::OnScreenKeyboard, "Keyboard");
}
_ => {
@@ -2111,14 +2270,14 @@ impl App {
}
}
Some(Target::Setting(Setting::AddServer)) => h(Control::Activate, "Add"),
Some(Target::Setting(Setting::Controls)) => {}
Some(Target::Setting(_)) => h(Control::Activate, "Change"),
Some(_) => h(Control::Activate, "Open"),
Some(_) => {}
None if self.current_page().is_some_and(|p| p.error.is_some()) => {
h(Control::Activate, "Try again")
}
None => {}
}
h(Control::Back, "Back");
if matches!(target, Some(Target::Song(_) | Target::Album(_) | Target::Playlist(_))) {
h(Control::Queue, "Add to queue");
}
@@ -2134,16 +2293,10 @@ impl App {
},
);
}
h(Control::PlayPause, "Play / Pause");
h(Control::Sections, "Sections");
h(Control::NowPlaying, "Now playing");
}
},
Screen::NowPlaying => {
h(Control::Activate, "Play selected");
h(Control::Back, "Back");
h(Control::PlayPause, "Play / Pause");
h(Control::Skip, "Skip");
h(
Control::Shuffle,
match self.shuffle {
@@ -2153,9 +2306,6 @@ impl App {
Mode::Albums => "Shuffle: albums",
},
);
h(Control::Seek, "Seek");
h(Control::Volume, "Volume");
h(Control::Mute, "Mute");
}
}
self.ui.set_hints(ModelRc::new(VecModel::from(hints)));
@@ -2462,7 +2612,7 @@ impl App {
Ok(songs) => app.shuffle_play(songs),
Err(e) => failed(app, e),
}),
Target::ShuffleAll | Target::Setting(_) => {}
Target::ShuffleAll | Target::Setting(_) | Target::ControlRow(_) => {}
}
}
@@ -2510,7 +2660,7 @@ impl App {
)
}
Target::Artist(_) => self.toast("Open the artist to queue one of their albums".into()),
Target::ShuffleAll | Target::Setting(_) => {}
Target::ShuffleAll | Target::Setting(_) | Target::ControlRow(_) => {}
}
}
@@ -3139,6 +3289,7 @@ impl App {
playing: Some(index) == self.current,
slider: false,
level: 0.0,
icons: ModelRc::default(),
}
}
}
@@ -3297,6 +3448,16 @@ fn settings_data(s: &Settings, logins: &Logins) -> PageData {
show_art: false,
target: Target::Setting(Setting::ShowHintBar),
},
Entry {
title: "Controls".to_string(),
subtitle: "Every button and key, for the controller in use or the keyboard".to_string(),
detail: String::new(),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::Controls),
},
],
..Default::default()
};
@@ -3318,6 +3479,31 @@ fn settings_data(s: &Settings, logins: &Logins) -> PageData {
data
}
fn controls_data() -> PageData {
PageData {
entries: CONTROL_ROWS
.iter()
.enumerate()
.map(|(i, row)| Entry {
title: row.label.to_string(),
// The one control that is a long press on a controller.
subtitle: if row.keys == Keys::Icons(Control::ShufflePlay) {
format!("{}, hold on a controller", row.group)
} else {
row.group.to_string()
},
detail: String::new(),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::ControlRow(i),
})
.collect(),
..Default::default()
}
}
/// One step of the volume, kept within 0 to 100.
fn step_volume(v: u8, up: bool) -> u8 {
let v = v.min(100);
@@ -3606,6 +3792,24 @@ mod tests {
assert!(has_version(false));
}
#[test]
fn the_controls_page_lists_every_control_in_groups() {
for control in Control::ALL {
assert!(
CONTROL_ROWS.iter().any(|r| r.keys == Keys::Icons(control)),
"{control:?} is missing"
);
}
// Each group in one run, so the page reads as groups.
let mut seen: Vec<&str> = Vec::new();
for row in CONTROL_ROWS {
if seen.last() != Some(&row.group) {
assert!(!seen.contains(&row.group), "{} is split", row.group);
seen.push(row.group);
}
}
}
#[test]
fn volume_steps_stay_in_range() {
assert_eq!(step_volume(50, true), 55);
+15
View File
@@ -31,6 +31,8 @@ export struct Item {
// A setting with a range: draws `level` (0 to 1) as a slider before `detail`.
slider: bool,
level: float,
// Button or key icons after `detail`, on the Controls page.
icons: [image],
}
export struct Header {
@@ -280,6 +282,19 @@ component Row inherits Rectangle {
horizontal-alignment: right;
vertical-alignment: center;
}
if root.item.icons.length > 0: HorizontalLayout {
spacing: 4px * Theme.s;
for icon in root.item.icons: VerticalLayout {
alignment: center;
Image {
source: icon;
height: 34px * Theme.s;
// Keys such as Space are wider than a button.
width: self.height * icon.width / max(1, icon.height);
}
}
}
}
TouchArea {