Compare commits

...
8 Commits
Author SHA1 Message Date
Ansho Rei d4de15acd8 feat: keep several logins and switch between them
config.toml now holds a list of [[server]] logins and the active one.
The single-login file of earlier versions loads as the only entry.

Settings lists the servers first: confirm switches, the queue button
pressed twice removes, and Add server opens the login form, which can
now be cancelled. Removing the last login returns to the login screen.

A switch saves the queue of the server being left, stops the player and
restores the other server's saved queue paused. Player events sent
before the stop are dropped by an epoch, and cover loads started for the
old server by a generation, so nothing of one server shows on the other.
Covers are cached on disk per server, keyed like the saved queue.

The shoulder triggers wrap around the sections, which puts Settings one
press from the first section.
2026-11-04 18:23:30 +01:00
Ansho Rei 0bcba21f1a feat: control playback through MPRIS
Remus owns org.mpris.MediaPlayer2.remus on the session bus and serves
the root and player interfaces: play, pause, play-pause, stop, next,
previous and quit, with the playback status, track metadata, position
and volume. Desktops route media keys to the active MPRIS player, and
headphone buttons arrive as media keys, so this is how they reach remus.

Reading the headphones' input devices directly was ruled out: keyboard
type devices, AVRCP included, are root:input, and only gamepads are
opened up to the logged-in user. Seeking is not offered (CanSeek false).

The Flatpak gets --own-name for the bus name.
2026-11-04 17:57:32 +01:00
Ansho Rei ab42814302 feat: add a setting to hide the controls bar
Settings has a Show controls bar toggle, on by default and saved as
show_hint_bar. Off, the hint bar goes from the browse and now-playing
screens and the content takes its height. The login screen keeps it,
since the controls are not known yet there and Settings is out of reach.

The bar is where the version shows, so while it is off Settings lists
the version instead.
2026-11-04 17:18:16 +01:00
Ansho Rei a5d51cf044 fix: place the volume level under the progress and in the bottom bar
On now playing it is centred under the progress bar. The bottom bar on
the other screens shows it too, at the right after the time and play
state. Its number has a fixed width: with only a minimum, the row gave
it the spare space and pushed the time into the middle.
2026-11-04 15:44:34 +01:00
Ansho Rei 0e7c63c09a feat: add volume control with the right stick and keys
Right stick up and down change the volume in steps of 5 and clicking it
mutes; + (or =), - and m do the same on a keyboard, on every screen. The
stick's dominant axis wins, so a diagonal push does not seek and change
the volume at once. Any step unmutes.

The level goes to playbin's volume on a cubic scale, so steps sound
even, and to its mute. A pill shows the level for a moment after each
change, the now-playing screen shows it under the times, and it is
saved in settings.toml once the changes stop and on quit.

Hint icons for the right stick and the keys are from Kenney's Input
Prompts 1.5, like the others.
2026-11-04 15:18:17 +01:00
Ansho Rei 5e1e120457 chore: keep downloads in an ignored .scratch directory
Ignored by git and skipped by the Flatpak build, so a fetched asset pack
such as Kenney's Input Prompts can stay around between sessions.
2026-11-04 15:18:17 +01:00
Ansho Rei 9be6f86557 feat: show play and pause icons instead of words on now playing
A PlayState component draws the triangle and the two bars as vectors in
the highlight colour. The mini player uses it too, in place of the ▶
and ❚❚ glyphs, which a font fallback could draw as emoji or at
different weights.
2026-11-04 14:40:50 +01:00
Ansho Rei 341ae614e1 feat: add a cover backdrop slider to the settings
The first range setting: its row draws a slider, and left and right
change it in steps of 10 while confirm still flips the toggles. Saved
as cover_backdrop in settings.toml, defaulting to the old fixed look.

Up to the default the cover fades in under the old overlay. Above it
the overlay thins as well, down to 0.55 on the left where the title and
progress sit, which kept them readable over a bright cover.
2026-11-04 14:31:17 +01:00
26 changed files with 1622 additions and 69 deletions
+1
View File
@@ -1 +1,2 @@
/target
/.scratch
+44
View File
@@ -2,6 +2,50 @@
One section per version, newest first.
## v0.8.0 (2026-11-04)
### Features
- Remus keeps several logins and switches between them from Settings, where the servers are listed first. Add server opens the login form, and Cancel goes back. Each server keeps its own queue: switching away stops it, and switching back brings it back paused where it was. A server is removed by pressing the queue button twice on its row.
- The shoulder triggers wrap around the sidebar, so Settings is one press back from Recently added.
- An existing login is kept as the first of the list, with nothing to re-enter.
## v0.7.0 (2026-11-04)
### Features
- Remus is an MPRIS player, so media keys, headphone buttons and the desktop's media controls can play, pause and skip, and the desktop shows the track that is playing. Headphone buttons work wherever the system passes them to MPRIS, as KDE does in Desktop Mode.
## v0.6.8 (2026-11-04)
### Features
- Settings has a Show controls bar toggle. Turned off, the bar with the button hints and the version is hidden on the browse and now-playing screens, and Settings lists the version instead. The login screen always shows it.
## v0.6.7 (2026-11-04)
### Bug fixes
- The volume level sits centred under the progress bar on the now-playing screen, and at the right of the bar at the bottom of the other screens, next to the time.
## v0.6.6 (2026-11-04)
### Features
- Volume control for remus's own playback, leaving the system volume alone. Right stick up and down changes it and clicking the right stick mutes; on a keyboard, + and - change it and m mutes. A level shows briefly after each change, the now-playing screen shows it under the times, and it is kept across restarts.
## v0.6.5 (2026-11-04)
### Features
- The now-playing screen shows a play or pause icon under the progress bar instead of the words Playing and Paused. The mini player uses the same icons, which no longer depend on the font.
## v0.6.4 (2026-11-04)
### Features
- Settings has a Cover backdrop slider for how much of the cover shows behind the now-playing screen, from off to 100 in steps of 10. Left and right change it. The default looks as before, and the strongest setting still keeps the text readable over a bright cover.
## v0.6.3 (2026-11-04)
### Features
Generated
+1 -1
View File
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "remus"
version = "0.6.3"
version = "0.8.0"
dependencies = [
"anyhow",
"directories",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "remus"
version = "0.6.3"
version = "0.8.0"
edition = "2024"
license = "MIT"
@@ -20,6 +20,13 @@
</supports>
<content_rating type="oars-1.1"/>
<releases>
<release version="0.8.0" date="2026-11-04"/>
<release version="0.7.0" date="2026-11-04"/>
<release version="0.6.8" date="2026-11-04"/>
<release version="0.6.7" date="2026-11-04"/>
<release version="0.6.6" date="2026-11-04"/>
<release version="0.6.5" date="2026-11-04"/>
<release version="0.6.4" date="2026-11-04"/>
<release version="0.6.3" date="2026-11-04"/>
<release version="0.6.2" date="2026-11-04"/>
<release version="0.6.1" date="2026-11-04"/>
+4
View File
@@ -18,6 +18,9 @@ finish-args:
# Keeps the screensaver off while music plays, the way Chromium and
# Electron apps do. The XDG portal route needs no permission.
- --talk-name=org.freedesktop.ScreenSaver
# MPRIS, through which the desktop's media keys and headphone buttons
# reach the player.
- --own-name=org.mpris.MediaPlayer2.remus
build-options:
append-path: /usr/lib/sdk/rust-stable/bin
@@ -45,6 +48,7 @@ modules:
- .git
- .worklane
- .flatpak-builder
- .scratch
- type: dir
path: ../target/flatpak/vendor
dest: vendor
+614 -37
View File
@@ -16,8 +16,9 @@ use slint::{Color, ComponentHandle, Image, ModelRc, Rgb8Pixel, SharedPixelBuffer
use tokio::runtime::Handle;
use tokio::sync::Semaphore;
use crate::config::{self, Config, Settings};
use crate::config::{self, Config, Logins, Settings};
use crate::inhibit::Inhibitor;
use crate::mpris::{self, Mpris};
use crate::palette::{Lab, Palette, Role, Tone};
use crate::player::{Player, PlayerEvent};
use crate::prompts::{self, Control, Family, Prompts};
@@ -65,6 +66,12 @@ pub fn shutdown() {
let app = APP.with(|cell| cell.borrow_mut().take());
if let Some(mut app) = app {
app.save_queue();
// A volume change made just before quitting is still waiting to save.
if app.volume_save_timer.running()
&& let Err(e) = config::save_settings(&app.settings)
{
log::warn!("saving settings: {e:#}");
}
if let Some(i) = app.inhibitor.take() {
i.shutdown();
}
@@ -111,7 +118,7 @@ impl Section {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
enum Target {
Album(String),
Artist(String),
@@ -124,6 +131,13 @@ enum Target {
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Setting {
AlbumArtColours,
CoverBackdrop,
ShowHintBar,
/// The version, listed while the hint bar that normally shows it is off.
Version,
/// A saved login, by index into `Logins::servers`.
Server(usize),
AddServer,
}
/// How long the UI takes to change from one palette to the next.
@@ -207,7 +221,12 @@ struct Covers {
pending: HashSet<CoverKey>,
failed: HashSet<CoverKey>,
limit: Arc<Semaphore>,
/// Per server, under `root`, since ids are only unique within a server.
dir: Option<PathBuf>,
root: Option<PathBuf>,
/// Bumped on a server switch, so a load started for the old server is
/// dropped when it lands instead of filling the new server's cache.
generation: u64,
}
pub struct App {
@@ -217,6 +236,15 @@ pub struct App {
player: Option<Player>,
/// Keeps the screensaver off while music plays. Taken at shutdown.
inhibitor: Option<Inhibitor>,
/// Media keys, headphone buttons and the desktop's media controls.
mpris: Mpris,
/// Every saved login and the one being browsed.
logins: Logins,
/// Bumped when the player is stopped for a server switch; player events
/// sent before that are dropped.
player_epoch: Arc<std::sync::atomic::AtomicU64>,
/// A server row whose remove button was pressed once, and when.
remove_armed: Option<(usize, Instant)>,
screen: Screen,
area: Area,
section: usize,
@@ -246,6 +274,10 @@ pub struct App {
last_save: Instant,
login_focus: i32,
toast_timer: Timer,
/// Hides the volume overlay a moment after the last change.
volume_timer: Timer,
/// Saves the volume once a run of changes is over.
volume_save_timer: Timer,
/// Keyboard keys or the buttons of the controller used last.
prompts: Prompts,
/// Decoded hint icons, so a selection move does not parse SVG again.
@@ -283,12 +315,19 @@ impl App {
log::warn!("cover cache disabled, cannot create {}: {e}", d.display());
}
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)));
});
App {
ui,
rt,
client: None,
player: None,
inhibitor: Some(inhibitor),
mpris,
logins: Logins::default(),
player_epoch: Arc::default(),
remove_armed: None,
screen: Screen::Login,
area: Area::Content,
section: 0,
@@ -305,7 +344,9 @@ impl App {
pending: HashSet::new(),
failed: HashSet::new(),
limit: Arc::new(Semaphore::new(6)),
dir,
dir: None,
root: dir,
generation: 0,
},
queue: Vec::new(),
current: None,
@@ -322,6 +363,8 @@ impl App {
last_save: Instant::now(),
login_focus: 0,
toast_timer: Timer::default(),
volume_timer: Timer::default(),
volume_save_timer: Timer::default(),
art_shown: None,
flip_timer: Timer::default(),
prompts: Prompts::Keyboard,
@@ -338,11 +381,23 @@ impl App {
}
fn start(&mut self) {
self.render_backdrop();
self.ui.set_show_hint_bar(self.settings.show_hint_bar);
let labels: Vec<SharedString> = SECTIONS.iter().map(|s| s.label().into()).collect();
self.ui.set_sections(ModelRc::new(VecModel::from(labels)));
match Player::spawn(|ev| {
let _ = slint::invoke_from_event_loop(move || with_app(move |app| app.player_event(ev)));
let epoch = self.player_epoch.clone();
match Player::spawn(move |ev| {
// Stamped when sent, so an event still on its way when the
// server is switched is recognised as the old server's.
let sent = epoch.load(std::sync::atomic::Ordering::Relaxed);
let _ = slint::invoke_from_event_loop(move || {
with_app(move |app| {
if app.player_epoch.load(std::sync::atomic::Ordering::Relaxed) == sent {
app.player_event(ev);
}
})
});
}) {
Ok(p) => self.player = Some(p),
Err(e) => {
@@ -350,17 +405,23 @@ impl App {
self.toast(format!("Playback unavailable: {e:#}"));
}
}
self.apply_volume();
match config::load() {
Ok(Some(cfg)) => {
log::info!("using saved login for {} on {}", cfg.username, cfg.url);
self.ui.set_login_server(cfg.url.clone().into());
self.ui.set_login_username(cfg.username.clone().into());
self.enter_browse(cfg.client());
}
Ok(None) => {
log::info!("no saved login, showing the login screen");
self.show_login();
Ok(logins) => {
self.logins = logins;
match self.logins.active().cloned() {
Some(cfg) => {
log::info!("using saved login for {} on {}", cfg.username, cfg.url);
self.ui.set_login_server(cfg.url.clone().into());
self.ui.set_login_username(cfg.username.clone().into());
self.enter_browse(cfg.client());
}
None => {
log::info!("no saved login, showing the login screen");
self.show_login();
}
}
}
Err(e) => {
log::error!("could not read the saved login: {e:#}");
@@ -388,9 +449,33 @@ impl App {
fn show_login(&mut self) {
self.screen = Screen::Login;
self.ui.set_screen(Screen::Login);
// Adding a server from inside the app: the bottom button goes back.
self.ui.set_login_can_cancel(self.client.is_some());
self.set_login_focus(0);
}
/// The login form, empty, for one more server.
fn add_server(&mut self) {
self.ui.set_login_server("".into());
self.ui.set_login_username("".into());
self.ui.set_login_password("".into());
self.ui.set_login_error("".into());
self.show_login();
}
/// Leaves the login form for the server that was being browsed.
fn cancel_login(&mut self) {
if self.client.is_none() {
return;
}
self.ui.set_login_password("".into());
self.ui.set_login_error("".into());
self.screen = Screen::Browse;
self.ui.set_screen(Screen::Browse);
let area = self.area;
self.set_area(area);
}
fn set_login_focus(&mut self, i: i32) {
self.login_focus = i.clamp(0, 4);
self.ui.set_login_focus(self.login_focus);
@@ -403,8 +488,10 @@ impl App {
Action::Up | Action::SectionPrev => self.set_login_focus(self.login_focus - 1),
Action::Down | Action::SectionNext => self.set_login_focus(self.login_focus + 1),
Action::Activate if self.login_focus < 2 => self.set_login_focus(self.login_focus + 1),
Action::Activate if self.login_focus == 4 && self.client.is_some() => self.cancel_login(),
Action::Activate if self.login_focus == 4 => self.action(Action::Quit),
Action::Activate => self.login_submit(),
Action::Back => self.cancel_login(),
_ => {}
}
}
@@ -437,10 +524,9 @@ impl App {
match r {
Ok(client) => {
app.ui.set_login_password("".into());
if let Err(e) = config::save(&Config::from_client(&client)) {
app.toast(format!("Could not save settings: {e:#}"));
}
app.enter_browse(client);
app.logins.add(Config::from_client(&client));
app.save_logins();
app.switch_server(client);
}
Err(e) => app.ui.set_login_error(login_error(&e).into()),
}
@@ -452,9 +538,20 @@ impl App {
let host = client.base().split("://").nth(1).unwrap_or(client.base()).to_string();
self.ui
.set_server_label(format!("{} on {}", client.user(), host).into());
// Keyed like the saved queue, by user and full address.
let key = sanitize(&format!("{}@{}", client.user(), client.base()));
self.covers.dir = self.covers.root.as_ref().map(|r| r.join(key));
if let Some(d) = &self.covers.dir
&& let Err(e) = std::fs::create_dir_all(d)
{
log::warn!("cover cache disabled, cannot create {}: {e}", d.display());
self.covers.dir = None;
}
self.client = Some(client);
self.covers.generation += 1;
self.covers.images.clear();
self.covers.tones.clear();
self.covers.prints.clear();
self.covers.pending.clear();
self.covers.failed.clear();
for stack in &mut self.stacks {
@@ -470,6 +567,107 @@ impl App {
}
}
/// Browses `client`'s server. The server being left keeps its queue on
/// disk and stops; the new one's saved queue comes back paused, so a
/// switch never starts music by itself.
fn switch_server(&mut self, client: Client) {
if self.client.is_some() {
self.save_queue();
self.stop_player();
self.queue.clear();
self.current = None;
self.queue_sel = 0;
self.position = 0.0;
self.duration = 0.0;
self.paused = false;
self.held = false;
self.scrobbled = false;
self.now_playing_due = false;
self.restoring = None;
self.art_shown = None;
self.flip_timer.stop();
self.ui.set_np_flip_out(false);
}
log::info!("browsing {} on {}", client.user(), client.base());
self.enter_browse(client);
self.render_player();
self.sync_queue(true);
self.sync_inhibit();
}
/// Stops playback for good, dropping whatever the player still has on
/// its way about the old queue.
fn stop_player(&self) {
if let Some(p) = &self.player {
p.stop();
}
self.player_epoch.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
}
fn save_logins(&mut self) {
if let Err(e) = config::save(&self.logins) {
self.toast(format!("Could not save the logins: {e:#}"));
}
}
fn select_server(&mut self, i: usize) {
if i == self.logins.active {
return;
}
let Some(cfg) = self.logins.servers.get(i).cloned() else {
return;
};
self.logins.active = i;
self.save_logins();
self.switch_server(cfg.client());
self.toast(format!("Switched to {}", cfg.label()));
}
/// The first press arms, a second within a few seconds removes.
fn remove_server(&mut self, i: usize) {
let Some(cfg) = self.logins.servers.get(i).cloned() else {
return;
};
let armed = self
.remove_armed
.is_some_and(|(j, at)| j == i && at.elapsed() < Duration::from_secs(4));
if !armed {
self.remove_armed = Some((i, Instant::now()));
self.toast(format!("Press again to remove {}", cfg.label()));
return;
}
self.remove_armed = None;
let was_active = i == self.logins.active;
self.logins.remove(i);
self.save_logins();
self.toast(format!("Removed {}", cfg.label()));
if !was_active {
self.refresh_settings();
return;
}
match self.logins.active().cloned() {
Some(next) => self.switch_server(next.client()),
None => {
// Nothing left to browse: stop, keep the queue on disk.
self.save_queue();
self.stop_player();
self.queue.clear();
self.current = None;
self.client = None;
self.render_player();
self.add_server();
}
}
}
/// The section that `delta` steps away, wrapping around, so Settings is
/// one press back from the first section.
fn section_step(&self, delta: isize) -> usize {
let n = SECTIONS.len() as isize;
let from = self.section.min(SECTIONS.len() - 1) as isize;
(from + delta).rem_euclid(n) as usize
}
// ---------------------------------------------------------------- input
/// A key pressed in the window.
@@ -507,6 +705,16 @@ impl App {
w.set_fullscreen(!w.is_fullscreen());
return;
}
// Everywhere, the login screen included.
Action::VolumeUp | Action::VolumeDown => {
self.change_volume(a == Action::VolumeUp);
return;
}
Action::ToggleMute => {
self.settings.muted = !self.settings.muted;
self.volume_changed();
return;
}
_ => {}
}
match self.screen {
@@ -566,8 +774,10 @@ impl App {
}
match self.area {
Area::Sidebar => match a {
Action::Up | Action::SectionPrev => self.select_section(self.section.saturating_sub(1)),
Action::Down | Action::SectionNext => self.select_section((self.section + 1).min(SECTIONS.len() - 1)),
Action::Up => self.select_section(self.section.saturating_sub(1)),
Action::Down => self.select_section((self.section + 1).min(SECTIONS.len() - 1)),
Action::SectionPrev => self.select_section(self.section_step(-1)),
Action::SectionNext => self.select_section(self.section_step(1)),
Action::Activate if SECTIONS[self.section] == Section::Random => {
self.reload_root();
self.enter_content();
@@ -576,14 +786,20 @@ impl App {
_ => {}
},
Area::Content => match a {
Action::Left | Action::Right if let Some(s) = self.selected_range_setting() => {
self.adjust_setting(s, a == Action::Right)
}
Action::Up | Action::Down | Action::Left | Action::Right | Action::PageUp | Action::PageDown => {
self.move_sel(a)
}
Action::Activate => self.activate(),
Action::Back => self.back(),
Action::Queue => self.enqueue_selected(),
Action::SectionNext => self.select_section((self.section + 1).min(SECTIONS.len() - 1)),
Action::SectionPrev => self.select_section(self.section.saturating_sub(1)),
Action::Queue => match self.selected_setting() {
Some(Setting::Server(i)) => self.remove_server(i),
_ => self.enqueue_selected(),
},
Action::SectionNext => self.select_section(self.section_step(1)),
Action::SectionPrev => self.select_section(self.section_step(-1)),
_ => {}
},
Area::Search => match a {
@@ -597,8 +813,8 @@ impl App {
self.run_search(q);
}
Action::Back | Action::Left => self.set_area(Area::Sidebar),
Action::SectionNext => self.select_section((self.section + 1).min(SECTIONS.len() - 1)),
Action::SectionPrev => self.select_section(self.section.saturating_sub(1)),
Action::SectionNext => self.select_section(self.section_step(1)),
Action::SectionPrev => self.select_section(self.section_step(-1)),
_ => {}
},
}
@@ -871,24 +1087,136 @@ impl App {
}
}
fn selected_setting(&self) -> Option<Setting> {
let page = self.current_page()?;
match page.entries.get(page.sel)?.target {
Target::Setting(s) => Some(s),
_ => None,
}
}
/// The range setting under the selection, which left and right adjust.
fn selected_range_setting(&self) -> Option<Setting> {
let page = self.current_page()?;
match page.entries.get(page.sel)?.target {
Target::Setting(s @ Setting::CoverBackdrop) => Some(s),
_ => None,
}
}
// ---------------------------------------------------------------- settings
fn toggle_setting(&mut self, setting: Setting) {
match setting {
Setting::AlbumArtColours => self.settings.album_art_colours = !self.settings.album_art_colours,
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(),
// A range: left and right change it, confirm does nothing.
Setting::CoverBackdrop | Setting::Version => return,
}
self.settings_changed();
}
/// Moves a range setting one step up or down.
fn adjust_setting(&mut self, setting: Setting, up: bool) {
match setting {
Setting::CoverBackdrop => {
let v = step_backdrop(self.settings.cover_backdrop, up);
if v == self.settings.cover_backdrop {
return;
}
self.settings.cover_backdrop = v;
}
Setting::AlbumArtColours
| Setting::ShowHintBar
| Setting::Version
| Setting::Server(_)
| Setting::AddServer => return,
}
self.settings_changed();
}
/// Saves the settings and shows what they change.
fn settings_changed(&mut self) {
if let Err(e) = config::save_settings(&self.settings) {
self.toast(format!("Could not save settings: {e:#}"));
}
let entries = settings_data(&self.settings).entries;
self.refresh_settings();
self.render_backdrop();
self.ui.set_show_hint_bar(self.settings.show_hint_bar);
self.update_theme();
}
/// Redraws the Settings rows, keeping the selection in range.
fn refresh_settings(&mut self) {
let entries = settings_data(&self.settings, &self.logins).entries;
let index = SECTIONS.iter().position(|s| *s == Section::Settings).unwrap_or(0);
if let Some(page) = self.stacks[index].first_mut() {
page.sel = page.sel.min(entries.len().saturating_sub(1));
page.entries = entries;
if self.section == index {
let sel = page.sel;
self.ui.set_selected(sel as i32);
self.sync_items(true);
self.render_hints();
}
}
self.update_theme();
}
fn render_backdrop(&self) {
let (opacity, left, right) = backdrop_look(self.settings.cover_backdrop);
self.ui.set_np_backdrop_opacity(opacity);
self.ui.set_np_backdrop_left(left);
self.ui.set_np_backdrop_right(right);
}
// ---------------------------------------------------------------- volume
fn change_volume(&mut self, up: bool) {
let v = step_volume(self.settings.volume, up);
// Any change unmutes, as on a phone: turning it up while muted should
// be heard.
let unmute = self.settings.muted;
if v == self.settings.volume && !unmute {
self.show_volume();
return;
}
self.settings.volume = v;
self.settings.muted = false;
self.volume_changed();
}
fn volume_changed(&mut self) {
self.apply_volume();
self.show_volume();
// Saved once the changes stop, not for every step of a held stick.
self.volume_save_timer
.start(slint::TimerMode::SingleShot, Duration::from_millis(800), || {
with_app(|app| {
if let Err(e) = config::save_settings(&app.settings) {
app.toast(format!("Could not save settings: {e:#}"));
}
})
});
}
fn apply_volume(&self) {
if let Some(p) = &self.player {
p.set_volume(self.settings.volume);
p.set_muted(self.settings.muted);
}
self.ui.set_volume(self.settings.volume as i32);
self.ui.set_muted(self.settings.muted);
self.sync_mpris();
}
fn show_volume(&mut self) {
self.ui.set_volume_shown(true);
self.volume_timer
.start(slint::TimerMode::SingleShot, Duration::from_millis(1500), || {
with_app(|app| app.ui.set_volume_shown(false))
});
}
// ---------------------------------------------------------------- theme
@@ -1007,7 +1335,7 @@ impl App {
fn load(&mut self, page_id: u64, source: Source) {
if matches!(source, Source::Section(Section::Settings)) {
let data = settings_data(&self.settings);
let data = settings_data(&self.settings, &self.logins);
self.page_loaded(page_id, Ok(data), true);
return;
}
@@ -1299,6 +1627,10 @@ impl App {
_ => false,
};
let cover = entry.cover.as_deref().and_then(|id| self.cover(id, px));
let level = match entry.target {
Target::Setting(Setting::CoverBackdrop) => Some(self.settings.cover_backdrop as f32 / 100.0),
_ => None,
};
Some(Item {
index: index as i32,
letter: initial(&entry.title).into(),
@@ -1312,6 +1644,8 @@ impl App {
round: entry.round,
show_art: entry.show_art,
playing,
slider: level.is_some(),
level: level.unwrap_or_default(),
})
}
@@ -1329,12 +1663,17 @@ impl App {
};
match self.screen {
Screen::Login => {
let adding = self.client.is_some();
let label = match self.login_focus {
0 | 1 => "Next",
4 if adding => "Cancel",
4 => "Exit",
_ => "Connect",
};
h(Control::Activate, label);
if adding {
h(Control::Back, "Cancel");
}
}
Screen::Browse => match self.area {
Area::Sidebar => {
@@ -1355,6 +1694,15 @@ impl App {
.map(|e| &e.target);
match target {
Some(Target::Song(_)) => h(Control::Activate, "Play"),
Some(Target::Setting(Setting::CoverBackdrop)) => h(Control::Seek, "Adjust"),
Some(Target::Setting(Setting::Version)) => {}
Some(Target::Setting(Setting::Server(i))) => {
if *i != self.logins.active {
h(Control::Activate, "Switch");
}
h(Control::Queue, "Remove");
}
Some(Target::Setting(Setting::AddServer)) => h(Control::Activate, "Add"),
Some(Target::Setting(_)) => h(Control::Activate, "Change"),
Some(_) => h(Control::Activate, "Open"),
None if self.current_page().is_some_and(|p| p.error.is_some()) => {
@@ -1377,6 +1725,8 @@ impl App {
h(Control::PlayPause, "Play / Pause");
h(Control::Skip, "Skip");
h(Control::Seek, "Seek");
h(Control::Volume, "Volume");
h(Control::Mute, "Mute");
}
}
self.ui.set_hints(ModelRc::new(VecModel::from(hints)));
@@ -1449,6 +1799,7 @@ impl App {
.as_ref()
.map(|d| d.join(format!("{}_{px}", sanitize(id))));
let id = id.to_string();
let generation = self.covers.generation;
self.spawn(
async move {
let _permit = limit.acquire_owned().await?;
@@ -1466,7 +1817,11 @@ impl App {
let decoded = tokio::task::spawn_blocking(move || decode_cover(&bytes, px)).await??;
Ok(decoded)
},
move |app, r| app.cover_loaded(key, r),
move |app, r| {
if app.covers.generation == generation {
app.cover_loaded(key, r);
}
},
);
None
}
@@ -1691,6 +2046,54 @@ impl App {
}
}
self.sync_inhibit();
self.sync_mpris();
}
/// Tells MPRIS clients what is playing.
fn sync_mpris(&self) {
let track = self.current.and_then(|i| self.queue.get(i).map(|s| (i, s)));
let status = match track {
None => mpris::Status::Stopped,
Some(_) if self.paused || self.held => mpris::Status::Paused,
Some(_) => mpris::Status::Playing,
};
let volume = if self.settings.muted {
0.0
} else {
self.settings.volume as f64 / 100.0
};
self.mpris.update(mpris::NowPlaying {
status,
track: track.map(|(index, s)| mpris::Track {
index,
title: s.title.clone(),
artist: s.artist.clone(),
album: s.album.clone(),
seconds: s.duration,
}),
volume,
});
}
/// A media key, headphone button or desktop control, through MPRIS.
fn mpris_command(&mut self, c: mpris::Command) {
let playing = self.current.is_some() && !self.paused && !self.held;
let action = match c {
mpris::Command::PlayPause => Action::PlayPause,
mpris::Command::Play if !playing => Action::PlayPause,
mpris::Command::Pause | mpris::Command::Stop if playing => Action::PlayPause,
mpris::Command::Next => Action::Next,
mpris::Command::Previous => Action::Prev,
mpris::Command::Quit => Action::Quit,
_ => return,
};
log::debug!("MPRIS {c:?}");
// Not on the login screen: nothing is loaded there.
if action == Action::Quit {
self.action(action);
} else if self.screen != Screen::Login {
self.global_action(action);
}
}
/// Inhibits only while sound is coming out: a restored queue is loaded
@@ -1797,6 +2200,7 @@ impl App {
self.ui.set_np_progress(progress as f32);
self.ui.set_np_position(fmt_time(self.position).into());
self.ui.set_np_duration(fmt_time(self.duration).into());
self.mpris.set_position(self.position);
}
fn render_player(&mut self) {
@@ -1824,6 +2228,7 @@ impl App {
}
}
self.render_progress();
self.sync_mpris();
self.update_theme();
}
@@ -2010,6 +2415,8 @@ impl App {
round: false,
show_art: true,
playing: Some(index) == self.current,
slider: false,
level: 0.0,
}
}
}
@@ -2095,21 +2502,136 @@ fn song_entry(s: &Song, index: usize) -> Entry {
}
}
fn settings_data(s: &Settings) -> PageData {
fn settings_data(s: &Settings, logins: &Logins) -> PageData {
let on_off = |on: bool| if on { "On" } else { "Off" }.to_string();
PageData {
entries: vec![Entry {
title: "Colours from album art".to_string(),
subtitle: "Tint the interface with the cover of the playing track".to_string(),
detail: on_off(s.album_art_colours),
let mut servers: Vec<Entry> = logins
.servers
.iter()
.enumerate()
.map(|(i, cfg)| Entry {
title: cfg.label(),
subtitle: if i == logins.active {
"Browsing now".to_string()
} else {
"Saved login".to_string()
},
detail: if i == logins.active {
"Active".to_string()
} else {
String::new()
},
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::AlbumArtColours),
}],
target: Target::Setting(Setting::Server(i)),
})
.collect();
servers.push(Entry {
title: "Add server".to_string(),
subtitle: "Log in to another Subsonic server, keeping this one".to_string(),
detail: String::new(),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::AddServer),
});
let mut data = PageData {
entries: vec![
Entry {
title: "Colours from album art".to_string(),
subtitle: "Tint the interface with the cover of the playing track".to_string(),
detail: on_off(s.album_art_colours),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::AlbumArtColours),
},
Entry {
title: "Cover backdrop".to_string(),
subtitle: "How much of the cover shows behind the now-playing screen".to_string(),
detail: if s.cover_backdrop == 0 {
"Off".to_string()
} else {
s.cover_backdrop.to_string()
},
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::CoverBackdrop),
},
Entry {
title: "Show controls bar".to_string(),
subtitle: "The buttons for each screen and the version, at the bottom".to_string(),
detail: on_off(s.show_hint_bar),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::ShowHintBar),
},
],
..Default::default()
};
// Servers first, so switching is the shortest reach in Settings.
data.entries.splice(0..0, servers);
// The bar is where the version normally shows.
if !s.show_hint_bar {
data.entries.push(Entry {
title: "Version".to_string(),
subtitle: String::new(),
detail: concat!("remus ", env!("CARGO_PKG_VERSION")).to_string(),
number: String::new(),
cover: None,
round: false,
show_art: false,
target: Target::Setting(Setting::Version),
});
}
data
}
/// One step of the volume, kept within 0 to 100.
fn step_volume(v: u8, up: bool) -> u8 {
let v = v.min(100);
if up { (v + 5).min(100) } else { v.saturating_sub(5) }
}
/// One step of the cover backdrop setting, kept within 0 to 100.
fn step_backdrop(v: u8, up: bool) -> u8 {
let v = v.min(100);
if up { (v + 10).min(100) } else { v.saturating_sub(10) }
}
/// The now-playing backdrop for a strength of 0 to 100: the cover's opacity
/// and the background alpha over it at the left and right edges.
///
/// Up to the default the cover fades in under today's overlay. Above it the
/// overlay thins too, but never below 0.55 on the left, where the title and
/// progress are, so the text stays readable over a bright cover.
fn backdrop_look(v: u8) -> (f32, f32, f32) {
// Today's look, reached at the default.
const OPACITY: f32 = 0.16;
const LEFT: f32 = 0.67;
const RIGHT: f32 = 0.95;
// The strongest, at 100.
const OPACITY_MAX: f32 = 0.40;
const LEFT_MIN: f32 = 0.55;
const RIGHT_MIN: f32 = 0.80;
let v = v.min(100) as f32;
let d = config::COVER_BACKDROP_DEFAULT as f32;
if v <= d {
return (OPACITY * v / d, LEFT, RIGHT);
}
let u = (v - d) / (100.0 - d);
(
OPACITY + u * (OPACITY_MAX - OPACITY),
LEFT + u * (LEFT_MIN - LEFT),
RIGHT + u * (RIGHT_MIN - RIGHT),
)
}
fn search_data(r: SearchResult) -> PageData {
@@ -2293,6 +2815,61 @@ mod tests {
assert_ne!(a, c);
}
#[test]
fn version_is_listed_in_settings_only_while_the_bar_is_hidden() {
let has_version = |show_hint_bar: bool| {
let s = Settings {
show_hint_bar,
..Settings::default()
};
settings_data(&s, &Logins::default())
.entries
.iter()
.any(|e| e.target == Target::Setting(Setting::Version))
};
assert!(!has_version(true));
assert!(has_version(false));
}
#[test]
fn volume_steps_stay_in_range() {
assert_eq!(step_volume(50, true), 55);
assert_eq!(step_volume(50, false), 45);
assert_eq!(step_volume(100, true), 100);
assert_eq!(step_volume(98, true), 100);
assert_eq!(step_volume(0, false), 0);
assert_eq!(step_volume(3, false), 0);
assert_eq!(step_volume(200, false), 95);
}
#[test]
fn default_backdrop_looks_like_before_it_was_a_setting() {
assert_eq!(backdrop_look(config::COVER_BACKDROP_DEFAULT), (0.16, 0.67, 0.95));
}
#[test]
fn backdrop_off_draws_no_cover() {
assert_eq!(backdrop_look(0).0, 0.0);
}
#[test]
fn backdrop_strongest_keeps_an_overlay() {
let (opacity, left, right) = backdrop_look(100);
assert!((opacity - 0.40).abs() < 1e-6);
assert!((left - 0.55).abs() < 1e-6);
assert!((right - 0.80).abs() < 1e-6);
assert_eq!(backdrop_look(250), backdrop_look(100));
}
#[test]
fn backdrop_steps_stay_in_range() {
assert_eq!(step_backdrop(30, true), 40);
assert_eq!(step_backdrop(30, false), 20);
assert_eq!(step_backdrop(100, true), 100);
assert_eq!(step_backdrop(0, false), 0);
assert_eq!(step_backdrop(200, false), 90);
}
#[test]
fn grid_window_is_row_aligned() {
assert_eq!(window(1000, 0, 5, false), (0, 55));
+200 -10
View File
@@ -69,30 +69,137 @@ pub fn state_dir() -> Option<PathBuf> {
dirs().map(|d| d.state_dir().unwrap_or(d.data_dir()).to_path_buf())
}
pub fn load() -> Result<Option<Config>> {
let Some(path) = config_path() else { return Ok(None) };
impl Config {
/// Names the server and user, as the sidebar shows them.
pub fn label(&self) -> String {
let host = self.url.split("://").nth(1).unwrap_or(&self.url);
format!("{} on {}", self.username, host.trim_end_matches('/'))
}
fn same_login(&self, other: &Config) -> bool {
self.url == other.url && self.username == other.username
}
}
/// Every saved login, and which one is browsed.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Logins {
/// Index into `servers`.
#[serde(default)]
pub active: usize,
/// `[[server]]` tables in the file.
#[serde(rename = "server", default)]
pub servers: Vec<Config>,
}
impl Logins {
pub fn active(&self) -> Option<&Config> {
self.servers.get(self.active)
}
/// Adds a login, or refreshes the saved one for the same server and user,
/// and makes it the active one.
pub fn add(&mut self, cfg: Config) {
match self.servers.iter().position(|s| s.same_login(&cfg)) {
Some(i) => {
self.servers[i] = cfg;
self.active = i;
}
None => {
self.servers.push(cfg);
self.active = self.servers.len() - 1;
}
}
}
/// Removes a login. The active one stays the same server where it can;
/// removing it makes the first remaining login active.
pub fn remove(&mut self, i: usize) {
if i >= self.servers.len() {
return;
}
self.servers.remove(i);
if i < self.active {
self.active -= 1;
} else if i == self.active {
self.active = 0;
}
}
}
/// The single login of earlier versions, or the list. Tried in that order:
/// every field of the list has a default, so it would take an old file as an
/// empty list, while the old shape needs `url` and `username` at the top.
#[derive(Deserialize)]
#[serde(untagged)]
enum Stored {
One(Config),
List(Logins),
}
fn parse_logins(text: &str) -> Result<Logins> {
Ok(match toml::from_str::<Stored>(text)? {
Stored::List(mut l) => {
if l.active >= l.servers.len() {
l.active = 0;
}
l
}
Stored::One(c) => Logins {
active: 0,
servers: vec![c],
},
})
}
pub fn load() -> Result<Logins> {
let Some(path) = config_path() else {
return Ok(Logins::default());
};
match fs::read_to_string(&path) {
Ok(text) => Ok(Some(
toml::from_str(&text).with_context(|| format!("parsing {}", path.display()))?,
)),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),
Ok(text) => parse_logins(&text).with_context(|| format!("parsing {}", path.display())),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(Logins::default()),
Err(e) => Err(e).with_context(|| format!("reading {}", path.display())),
}
}
pub fn save(cfg: &Config) -> Result<()> {
pub fn save(logins: &Logins) -> Result<()> {
let path = config_path().context("no config directory")?;
write_atomic(&path, &toml::to_string(cfg)?)?;
log::info!("saved login to {}", path.display());
write_atomic(&path, &toml::to_string(logins)?)?;
log::info!("saved {} login(s) to {}", logins.servers.len(), path.display());
Ok(())
}
/// Preferences. Kept apart from the login, so logging out does not reset them.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(default)]
pub struct Settings {
/// Tint the UI with the colours of the playing track's cover.
pub album_art_colours: bool,
/// How strongly the cover shows behind the now-playing screen, 0 to 100.
pub cover_backdrop: u8,
/// Playback volume, 0 to 100. Only remus's own stream, not the system's.
pub volume: u8,
/// Muted, keeping `volume` for when it is unmuted.
pub muted: bool,
/// The bar with the button hints and the version. The login screen shows
/// it regardless.
pub show_hint_bar: bool,
}
/// The cover backdrop strength that looks like it did before it was a setting.
pub const COVER_BACKDROP_DEFAULT: u8 = 30;
impl Default for Settings {
fn default() -> Self {
Settings {
album_art_colours: false,
cover_backdrop: COVER_BACKDROP_DEFAULT,
volume: 100,
muted: false,
show_hint_bar: true,
}
}
}
fn settings_path() -> Option<PathBuf> {
@@ -188,17 +295,100 @@ mod tests {
assert!(!text.contains("salt") && !text.contains("token"), "{text}");
}
fn login(url: &str, user: &str, auth: Auth) -> Config {
Config::from_client(&Client::new(url, user, auth))
}
#[test]
fn a_single_login_file_loads_as_the_only_login() {
let old = "url = \"https://h\"\nusername = \"u\"\nsalt = \"s\"\ntoken = \"t\"\n";
let l = parse_logins(old).unwrap();
assert_eq!(l.servers.len(), 1);
assert_eq!(l.active, 0);
assert_eq!(l.active().unwrap().username, "u");
let old = "url = \"https://h\"\nusername = \"u\"\npassword = \"p\"\n";
let l = parse_logins(old).unwrap();
assert_eq!(*l.active().unwrap().client().auth(), Auth::Password("p".into()));
}
#[test]
fn the_login_list_round_trips_with_both_auth_methods() {
let mut l = Logins::default();
l.add(login(
"https://a",
"u",
Auth::Token {
salt: "s".into(),
token: "t".into(),
},
));
l.add(login("https://b", "v", Auth::Password("p".into())));
let text = toml::to_string(&l).unwrap();
assert!(text.contains("[[server]]"), "{text}");
let back = parse_logins(&text).unwrap();
assert_eq!(back, l);
assert_eq!(back.active, 1);
}
#[test]
fn adding_the_same_login_again_replaces_it() {
let mut l = Logins::default();
l.add(login("https://a", "u", Auth::Password("old".into())));
l.add(login("https://b", "u", Auth::Password("p".into())));
l.add(login("https://a", "u", Auth::Password("new".into())));
assert_eq!(l.servers.len(), 2);
assert_eq!(l.active, 0);
assert_eq!(*l.servers[0].client().auth(), Auth::Password("new".into()));
}
#[test]
fn removing_keeps_the_active_server_where_it_can() {
let mut l = Logins::default();
for host in ["https://a", "https://b", "https://c"] {
l.add(login(host, "u", Auth::Password("p".into())));
}
l.active = 2;
l.remove(0);
assert_eq!(l.active().unwrap().url, "https://c");
l.remove(1);
assert_eq!(l.active().unwrap().url, "https://b");
l.remove(0);
assert!(l.active().is_none());
}
#[test]
fn an_out_of_range_active_index_falls_back_to_the_first() {
let text = "active = 5\n[[server]]\nurl = \"https://a\"\nusername = \"u\"\npassword = \"p\"\n";
assert_eq!(parse_logins(text).unwrap().active, 0);
}
#[test]
fn settings_default_when_fields_are_missing() {
let s: Settings = toml::from_str("").unwrap();
assert_eq!(s, Settings::default());
assert!(!s.album_art_colours);
assert_eq!(s.cover_backdrop, COVER_BACKDROP_DEFAULT);
assert_eq!(s.volume, 100);
assert!(!s.muted);
assert!(s.show_hint_bar);
}
#[test]
fn settings_from_before_the_backdrop_load_its_default() {
let s: Settings = toml::from_str("album_art_colours = true\n").unwrap();
assert!(s.album_art_colours);
assert_eq!(s.cover_backdrop, COVER_BACKDROP_DEFAULT);
assert!(s.show_hint_bar);
}
#[test]
fn settings_round_trip() {
let s = Settings {
album_art_colours: true,
cover_backdrop: 70,
volume: 35,
muted: true,
show_hint_bar: false,
};
let back: Settings = toml::from_str(&toml::to_string(&s).unwrap()).unwrap();
assert_eq!(back, s);
+4
View File
@@ -88,9 +88,13 @@ fn step(ui: slint::Weak<AppWindow>, steps: Vec<String>, i: usize) {
"next" => Action::Next,
"play-pause" => Action::PlayPause,
"section-next" => Action::SectionNext,
"section-prev" => Action::SectionPrev,
"now-playing" => Action::NowPlaying,
"search" => Action::Search,
"quit" => Action::Quit,
"volume-up" => Action::VolumeUp,
"volume-down" => Action::VolumeDown,
"mute" => Action::ToggleMute,
other => {
log::warn!("unknown dev script step {other}");
Action::None
+9 -3
View File
@@ -93,7 +93,7 @@ pub fn spawn_gamepad(emit: impl Fn(PadEvent) + Send + 'static) {
EventType::AxisChanged(axis, value, _) => {
let source = match axis {
Axis::LeftStickX | Axis::LeftStickY => Source::LeftStick,
Axis::RightStickX => Source::RightStick,
Axis::RightStickX | Axis::RightStickY => Source::RightStick,
_ => continue,
};
let pad = gilrs.gamepad(ev.id);
@@ -226,6 +226,7 @@ fn button_action(b: Button) -> Option<Action> {
Button::RightTrigger2 => Action::SectionNext,
Button::Start => Action::NowPlaying,
Button::Select => Action::Search,
Button::RightThumb => Action::ToggleMute,
_ => return None,
})
}
@@ -247,12 +248,17 @@ fn stick_direction(source: Source, pad: &gilrs::Gamepad<'_>, _changed: f32, held
Some(if y > 0.0 { Action::Up } else { Action::Down })
}
}
// Across seeks, up and down set the volume. The dominant axis wins, so
// a diagonal push does only one of them.
Source::RightStick => {
let x = pad.value(Axis::RightStickX);
if x.abs() < threshold {
let y = pad.value(Axis::RightStickY);
if x.abs() < threshold && y.abs() < threshold {
None
} else {
} else if x.abs() > y.abs() {
Some(if x > 0.0 { Action::SeekForward } else { Action::SeekBack })
} else {
Some(if y > 0.0 { Action::VolumeUp } else { Action::VolumeDown })
}
}
Source::DPad => None,
+1
View File
@@ -5,6 +5,7 @@ mod config;
mod devscript;
mod inhibit;
mod input;
mod mpris;
mod palette;
mod player;
mod prompts;
+368
View File
@@ -0,0 +1,368 @@
//! MPRIS on the session bus, so the desktop's media controls and media keys
//! can drive playback. Headphone buttons arrive this way too: the desktop
//! turns the key events of a headset or a Bluetooth AVRCP device into calls
//! on the active MPRIS player. Reading those devices directly is not an
//! option, since keyboard-like input devices are root:input and only
//! gamepads are opened up to the logged-in user.
//!
//! A bus that cannot be reached, or a name already taken by another remus,
//! is logged once and otherwise ignored.
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::atomic::{AtomicI64, Ordering};
use anyhow::Result;
use tokio::runtime::Handle;
use tokio::sync::watch;
use zbus::interface;
use zbus::zvariant::{ObjectPath, OwnedValue, Value};
const BUS_NAME: &str = "org.mpris.MediaPlayer2.remus";
const PATH: &str = "/org/mpris/MediaPlayer2";
const DESKTOP_ENTRY: &str = "me.anshorei.Fettleshed.Remus";
/// What a client asked for.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Command {
PlayPause,
Play,
Pause,
Stop,
Next,
Previous,
Quit,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum Status {
#[default]
Stopped,
Paused,
Playing,
}
impl Status {
fn as_str(self) -> &'static str {
match self {
Status::Stopped => "Stopped",
Status::Paused => "Paused",
Status::Playing => "Playing",
}
}
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Track {
/// Position in the queue, which makes the track id.
pub index: usize,
pub title: String,
pub artist: Option<String>,
pub album: Option<String>,
pub seconds: Option<u32>,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NowPlaying {
pub status: Status,
pub track: Option<Track>,
/// 0 to 1, already muted to 0.
pub volume: f64,
}
pub struct Mpris {
state: watch::Sender<NowPlaying>,
position: Arc<AtomicI64>,
}
impl Mpris {
pub fn spawn(rt: &Handle, on_command: impl Fn(Command) + Send + Sync + 'static) -> Mpris {
let (state, rx) = watch::channel(NowPlaying::default());
let position = Arc::new(AtomicI64::new(0));
let pos = position.clone();
let on_command: Arc<dyn Fn(Command) + Send + Sync> = Arc::new(on_command);
rt.spawn(async move {
if let Err(e) = run(rx, pos, on_command).await {
log::warn!("MPRIS unavailable, media keys will not reach remus: {e:#}");
}
});
Mpris { state, position }
}
/// Publishes what is playing. Clients hear only about what changed.
pub fn update(&self, now: NowPlaying) {
self.state.send_if_modified(|s| {
let changed = *s != now;
*s = now;
changed
});
}
/// Clients read the position when they want it; it sends no signal.
pub fn set_position(&self, seconds: f64) {
self.position.store((seconds * 1e6) as i64, Ordering::Relaxed);
}
}
async fn run(
mut rx: watch::Receiver<NowPlaying>,
position: Arc<AtomicI64>,
on_command: Arc<dyn Fn(Command) + Send + Sync>,
) -> Result<()> {
let player = Player {
now: rx.borrow().clone(),
position,
on_command: on_command.clone(),
};
let conn = zbus::connection::Builder::session()?
.name(BUS_NAME)?
.serve_at(PATH, Root { on_command })?
.serve_at(PATH, player)?
.build()
.await?;
log::info!("MPRIS player registered as {BUS_NAME}");
let iface = conn.object_server().interface::<_, Player>(PATH).await?;
while rx.changed().await.is_ok() {
let now = rx.borrow_and_update().clone();
let mut p = iface.get_mut().await;
let status = p.now.status != now.status;
let track = p.now.track != now.track;
let volume = p.now.volume != now.volume;
p.now = now;
let emitter = iface.signal_emitter();
if status {
p.playback_status_changed(emitter).await?;
}
if track {
p.metadata_changed(emitter).await?;
p.can_play_changed(emitter).await?;
p.can_pause_changed(emitter).await?;
p.can_go_next_changed(emitter).await?;
p.can_go_previous_changed(emitter).await?;
}
if volume {
p.volume_changed(emitter).await?;
}
}
Ok(())
}
struct Root {
on_command: Arc<dyn Fn(Command) + Send + Sync>,
}
#[interface(name = "org.mpris.MediaPlayer2")]
impl Root {
fn raise(&self) {}
fn quit(&self) {
(self.on_command)(Command::Quit);
}
#[zbus(property)]
fn can_quit(&self) -> bool {
true
}
#[zbus(property)]
fn can_raise(&self) -> bool {
false
}
#[zbus(property)]
fn has_track_list(&self) -> bool {
false
}
#[zbus(property)]
fn identity(&self) -> &str {
"Remus"
}
#[zbus(property)]
fn desktop_entry(&self) -> &str {
DESKTOP_ENTRY
}
#[zbus(property)]
fn supported_uri_schemes(&self) -> Vec<String> {
Vec::new()
}
#[zbus(property)]
fn supported_mime_types(&self) -> Vec<String> {
Vec::new()
}
}
struct Player {
now: NowPlaying,
position: Arc<AtomicI64>,
on_command: Arc<dyn Fn(Command) + Send + Sync>,
}
#[interface(name = "org.mpris.MediaPlayer2.Player")]
impl Player {
fn play_pause(&self) {
(self.on_command)(Command::PlayPause);
}
fn play(&self) {
(self.on_command)(Command::Play);
}
fn pause(&self) {
(self.on_command)(Command::Pause);
}
fn stop(&self) {
(self.on_command)(Command::Stop);
}
fn next(&self) {
(self.on_command)(Command::Next);
}
fn previous(&self) {
(self.on_command)(Command::Previous);
}
// CanSeek is false, so clients do not call these; they are part of the
// interface all the same.
fn seek(&self, _offset: i64) {}
fn set_position(&self, _track_id: ObjectPath<'_>, _position: i64) {}
fn open_uri(&self, _uri: &str) {}
#[zbus(property)]
fn playback_status(&self) -> &str {
self.now.status.as_str()
}
#[zbus(property)]
fn rate(&self) -> f64 {
1.0
}
#[zbus(property)]
fn minimum_rate(&self) -> f64 {
1.0
}
#[zbus(property)]
fn maximum_rate(&self) -> f64 {
1.0
}
#[zbus(property)]
fn metadata(&self) -> HashMap<String, OwnedValue> {
metadata(self.now.track.as_ref())
}
#[zbus(property)]
fn volume(&self) -> f64 {
self.now.volume
}
#[zbus(property(emits_changed_signal = "false"))]
fn position(&self) -> i64 {
self.position.load(Ordering::Relaxed)
}
#[zbus(property)]
fn can_go_next(&self) -> bool {
self.now.track.is_some()
}
#[zbus(property)]
fn can_go_previous(&self) -> bool {
self.now.track.is_some()
}
#[zbus(property)]
fn can_play(&self) -> bool {
self.now.track.is_some()
}
#[zbus(property)]
fn can_pause(&self) -> bool {
self.now.track.is_some()
}
#[zbus(property)]
fn can_seek(&self) -> bool {
false
}
#[zbus(property(emits_changed_signal = "const"))]
fn can_control(&self) -> bool {
true
}
}
/// The MPRIS metadata map for a track, empty when nothing is loaded.
fn metadata(track: Option<&Track>) -> HashMap<String, OwnedValue> {
let mut m = HashMap::new();
let Some(t) = track else {
let none = ObjectPath::from_static_str_unchecked("/org/mpris/MediaPlayer2/TrackList/NoTrack");
insert(&mut m, "mpris:trackid", Value::from(none));
return m;
};
// Outside /org/mpris, which the spec reserves.
let id = format!("/me/anshorei/Fettleshed/Remus/track/{}", t.index);
if let Ok(path) = ObjectPath::try_from(id) {
insert(&mut m, "mpris:trackid", Value::from(path));
}
insert(&mut m, "xesam:title", Value::from(t.title.clone()));
if let Some(a) = &t.artist {
insert(&mut m, "xesam:artist", Value::from(vec![a.clone()]));
}
if let Some(a) = &t.album {
insert(&mut m, "xesam:album", Value::from(a.clone()));
}
if let Some(s) = t.seconds {
insert(&mut m, "mpris:length", Value::from(s as i64 * 1_000_000));
}
m
}
fn insert(m: &mut HashMap<String, OwnedValue>, key: &str, value: Value<'_>) {
if let Ok(v) = OwnedValue::try_from(value) {
m.insert(key.to_string(), v);
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn metadata_without_a_track_says_so() {
let m = metadata(None);
assert_eq!(m.len(), 1);
let id: ObjectPath = m["mpris:trackid"].clone().try_into().unwrap();
assert_eq!(id.as_str(), "/org/mpris/MediaPlayer2/TrackList/NoTrack");
}
#[test]
fn metadata_carries_the_track() {
let t = Track {
index: 3,
title: "Feijão".into(),
artist: Some("Dr. Quandary".into()),
album: None,
seconds: Some(218),
};
let m = metadata(Some(&t));
let title: String = m["xesam:title"].clone().try_into().unwrap();
assert_eq!(title, "Feijão");
let artists: Vec<String> = m["xesam:artist"].clone().try_into().unwrap();
assert_eq!(artists, ["Dr. Quandary"]);
let length: i64 = m["mpris:length"].clone().try_into().unwrap();
assert_eq!(length, 218_000_000);
assert!(!m.contains_key("xesam:album"));
let id: ObjectPath = m["mpris:trackid"].clone().try_into().unwrap();
assert_eq!(id.as_str(), "/me/anshorei/Fettleshed/Remus/track/3");
}
}
+18
View File
@@ -143,6 +143,13 @@ impl Player {
start(&self.playbin, &url);
}
/// Stops playback and forgets the queue, as when switching server. Going
/// to Null flushes the bus, so nothing from the old track reports later.
pub fn stop(&self) {
*lock(&self.queue) = Queue::default();
let _ = self.playbin.set_state(gst::State::Null);
}
pub fn toggle_pause(&self) {
// Toggles where the pipeline is heading, so play pressed while a
// paused track is still loading is not lost.
@@ -177,6 +184,17 @@ impl Player {
}
}
/// Sets remus's own playback volume, 0 to 100. Cubic, so equal steps
/// sound equally loud apart.
pub fn set_volume(&self, level: u8) {
let v = level.min(100) as f64 / 100.0;
self.playbin.set_property("volume", v * v * v);
}
pub fn set_muted(&self, muted: bool) {
self.playbin.set_property("mute", muted);
}
pub fn seek(&self, seconds: f64) {
let Some(pos) = self.playbin.query_position::<gst::ClockTime>() else {
return;
+15 -1
View File
@@ -33,6 +33,8 @@ pub enum Control {
Search,
NowPlaying,
Seek,
Volume,
Mute,
/// Steam + X brings up Steam's on-screen keyboard. Nothing to show for a
/// real keyboard.
OnScreenKeyboard,
@@ -40,7 +42,7 @@ pub enum Control {
#[cfg(test)]
impl Control {
pub const ALL: [Control; 10] = [
pub const ALL: [Control; 12] = [
Control::Activate,
Control::Back,
Control::PlayPause,
@@ -50,6 +52,8 @@ impl Control {
Control::Search,
Control::NowPlaying,
Control::Seek,
Control::Volume,
Control::Mute,
Control::OnScreenKeyboard,
];
}
@@ -75,6 +79,8 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Search => &[icon!("keyboard", "keyboard_slash_forward")],
NowPlaying => &[icon!("keyboard", "keyboard_f")],
Seek => &[icon!("keyboard", "keyboard_arrows_horizontal")],
Volume => &[icon!("keyboard", "keyboard_minus"), icon!("keyboard", "keyboard_plus")],
Mute => &[icon!("keyboard", "keyboard_m")],
OnScreenKeyboard => &[],
},
Prompts::Pad(Family::Xbox) => match control {
@@ -87,6 +93,8 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Search => &[icon!("xbox", "xbox_button_view")],
NowPlaying => &[icon!("xbox", "xbox_button_menu")],
Seek => &[icon!("xbox", "xbox_dpad_horizontal")],
Volume => &[icon!("xbox", "xbox_stick_r_vertical")],
Mute => &[icon!("xbox", "xbox_stick_r_press")],
OnScreenKeyboard => &[icon!("xbox", "xbox_guide"), icon!("xbox", "xbox_button_color_x")],
},
Prompts::Pad(Family::PlayStation) => match control {
@@ -105,6 +113,8 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Search => &[icon!("playstation", "playstation5_button_create")],
NowPlaying => &[icon!("playstation", "playstation5_button_options")],
Seek => &[icon!("playstation", "playstation_dpad_horizontal")],
Volume => &[icon!("playstation", "playstation_stick_r_vertical")],
Mute => &[icon!("playstation", "playstation_stick_r_press")],
// The pack has no PS button; Steam's own label says the same thing.
OnScreenKeyboard => &[
icon!("steamdeck", "steamdeck_button_guide"),
@@ -122,6 +132,8 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Search => &[icon!("switch", "switch_button_minus")],
NowPlaying => &[icon!("switch", "switch_button_plus")],
Seek => &[icon!("switch", "switch_dpad_horizontal")],
Volume => &[icon!("switch", "switch_stick_r_vertical")],
Mute => &[icon!("switch", "switch_stick_r_press")],
OnScreenKeyboard => &[
icon!("switch", "switch_button_home"),
icon!("switch", "switch_button_y"),
@@ -143,6 +155,8 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Search => &[icon!("steamdeck", "steamdeck_button_view")],
NowPlaying => &[icon!("steamdeck", "steamdeck_button_options")],
Seek => &[icon!("steamdeck", "steamdeck_dpad_horizontal")],
Volume => &[icon!("steamdeck", "steamdeck_stick_r_vertical")],
Mute => &[icon!("steamdeck", "steamdeck_stick_r_press")],
OnScreenKeyboard => &[
icon!("steamdeck", "steamdeck_button_guide"),
icon!("steamdeck", "steamdeck_button_x"),
+269 -16
View File
@@ -9,6 +9,7 @@ export enum Action {
none, up, down, left, right, page-up, page-down, activate, back,
play-pause, next, prev, queue, section-next, section-prev,
now-playing, search, seek-forward, seek-back, toggle-fullscreen, quit,
volume-up, volume-down, toggle-mute,
}
export enum Screen { login, browse, now-playing }
@@ -27,6 +28,9 @@ export struct Item {
round: bool,
show-art: bool,
playing: bool,
// A setting with a range: draws `level` (0 to 1) as a slider before `detail`.
slider: bool,
level: float,
}
export struct Header {
@@ -237,10 +241,38 @@ component Row inherits Rectangle {
}
}
if root.item.slider: VerticalLayout {
alignment: center;
Rectangle {
width: 180px * Theme.s;
height: 6px * Theme.s;
border-radius: 3px * Theme.s;
background: Theme.line;
Rectangle {
x: 0;
width: parent.width * root.item.level;
border-radius: 3px * Theme.s;
background: root.selected && root.active ? Theme.highlight : Theme.muted;
animate width { duration: 120ms; easing: ease-out; }
}
Rectangle {
x: parent.width * root.item.level - self.width / 2;
width: 16px * Theme.s;
height: 16px * Theme.s;
border-radius: 8px * Theme.s;
background: root.selected && root.active ? Theme.text : Theme.muted;
animate x { duration: 120ms; easing: ease-out; }
}
}
}
Text {
// Fixed for a slider, so the bar does not shift as the number grows.
min-width: root.item.slider ? 44px * Theme.s : 0;
text: root.item.detail;
font-size: 15px * Theme.s;
color: Theme.muted;
horizontal-alignment: right;
vertical-alignment: center;
}
}
@@ -473,6 +505,166 @@ component SearchBox inherits Rectangle {
}
}
// Play triangle or pause bars, drawn as vectors so no font fallback can turn
// them into emoji or give the two different weights.
component PlayState {
in property <bool> paused;
in property <color> tint: Theme.highlight;
in property <length> size: 14px * Theme.s;
width: root.size;
height: root.size;
if !root.paused: Path {
width: root.size;
height: root.size;
viewbox-width: 12;
viewbox-height: 12;
commands: "M 1.5 0.5 L 11.5 6 L 1.5 11.5 Z";
fill: root.tint;
}
if root.paused: Rectangle {
x: root.size * 0.12;
width: root.size * 0.28;
height: root.size;
border-radius: root.size * 0.06;
background: root.tint;
}
if root.paused: Rectangle {
x: root.size * 0.60;
width: root.size * 0.28;
height: root.size;
border-radius: root.size * 0.06;
background: root.tint;
}
}
// A speaker with sound waves, or with a cross when muted.
component Speaker {
in property <bool> muted;
in property <color> tint: Theme.text;
in property <length> size: 16px * Theme.s;
width: root.size;
height: root.size;
Path {
width: root.size;
height: root.size;
viewbox-width: 16;
viewbox-height: 16;
commands: "M 1 5.5 L 4.5 5.5 L 8.5 2 L 8.5 14 L 4.5 10.5 L 1 10.5 Z";
fill: root.tint;
}
Path {
width: root.size;
height: root.size;
viewbox-width: 16;
viewbox-height: 16;
commands: root.muted
? "M 10.5 5.5 L 15 10 M 15 5.5 L 10.5 10"
: "M 10.5 5.5 A 3.2 3.2 0 0 1 10.5 10.5 M 12.5 3.5 A 6 6 0 0 1 12.5 12.5";
stroke: root.tint;
stroke-width: 1.6px * root.size / 16px;
}
}
// A quiet speaker, bar and number for the current volume.
component VolumeLevel inherits HorizontalLayout {
in property <int> level;
in property <bool> muted;
in property <length> font-size: 13px * Theme.s;
spacing: 10px * Theme.s;
// Its own width only, so a stretching row does not hand it the slack.
horizontal-stretch: 0;
VerticalLayout {
alignment: center;
Speaker {
muted: root.muted || root.level == 0;
tint: Theme.muted;
size: 14px * Theme.s;
}
}
VerticalLayout {
alignment: center;
Rectangle {
width: 90px * Theme.s;
height: 4px * Theme.s;
border-radius: 2px * Theme.s;
background: Theme.raised;
Rectangle {
x: 0;
width: parent.width * (root.muted ? 0 : root.level / 100);
border-radius: 2px * Theme.s;
background: Theme.muted;
}
}
}
Text {
// Fixed, so the bar does not shift as the number changes, and wide
// enough for "Muted".
width: 4.2 * root.font-size;
text: root.muted ? "Muted" : root.level;
font-size: root.font-size;
color: Theme.muted;
vertical-alignment: center;
}
}
// The level after a volume change, faded out again by the app after a moment.
component VolumeOverlay inherits Rectangle {
in property <bool> shown;
in property <int> level;
in property <bool> muted;
width: 300px * Theme.s;
height: 56px * Theme.s;
border-radius: 28px * Theme.s;
background: Theme.raised;
border-width: 1px * Theme.s;
border-color: Theme.line;
drop-shadow-blur: 20px * Theme.s;
drop-shadow-color: #00000080;
opacity: root.shown ? 1 : 0;
animate opacity { duration: 180ms; }
HorizontalLayout {
padding-left: 22px * Theme.s;
padding-right: 22px * Theme.s;
spacing: 14px * Theme.s;
VerticalLayout {
alignment: center;
Speaker {
muted: root.muted || root.level == 0;
size: 22px * Theme.s;
}
}
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
Rectangle {
height: 6px * Theme.s;
border-radius: 3px * Theme.s;
background: Theme.line;
Rectangle {
x: 0;
width: parent.width * (root.muted ? 0 : root.level / 100);
border-radius: 3px * Theme.s;
background: Theme.highlight;
animate width { duration: 100ms; easing: ease-out; }
}
}
}
Text {
min-width: 48px * Theme.s;
text: root.muted ? "Muted" : root.level;
font-size: 16px * Theme.s;
color: Theme.text;
horizontal-alignment: right;
vertical-alignment: center;
}
}
}
component NowBar inherits Rectangle {
in property <bool> has-track;
in property <string> title;
@@ -484,6 +676,8 @@ component NowBar inherits Rectangle {
in property <float> progress;
in property <string> time;
in property <bool> paused;
in property <int> volume;
in property <bool> muted;
background: Theme.panel;
@@ -543,11 +737,18 @@ component NowBar inherits Rectangle {
color: Theme.muted;
vertical-alignment: center;
}
if root.has-track: Text {
text: root.paused ? "❚❚" : "▶";
font-size: 18px * Theme.s;
color: Theme.highlight;
vertical-alignment: center;
if root.has-track: VerticalLayout {
alignment: center;
PlayState {
paused: root.paused;
size: 15px * Theme.s;
}
}
if root.has-track: Rectangle { width: 6px * Theme.s; }
if root.has-track: VolumeLevel {
level: root.volume;
muted: root.muted;
font-size: 15px * Theme.s;
}
}
}
@@ -640,6 +841,8 @@ component LoginView inherits Rectangle {
in property <int> focus-index;
in property <string> error;
in property <bool> busy;
// Adding a server from inside the app: the bottom button goes back.
in property <bool> can-cancel;
callback submit;
callback exit;
callback field-clicked(int);
@@ -719,7 +922,7 @@ component LoginView inherits Rectangle {
border-width: 2px * Theme.s;
border-color: root.focus-index == 4 ? Theme.focus : Theme.line;
Text {
text: "Exit";
text: root.can-cancel ? "Cancel" : "Exit";
font-size: 17px * Theme.s;
color: root.focus-index == 4 ? Theme.text : Theme.muted;
}
@@ -756,6 +959,13 @@ component NowPlayingView inherits Rectangle {
in property <string> duration;
in property <bool> paused;
in property <bool> has-track;
// From the cover backdrop setting: the blown-up cover's opacity and the
// alpha of the background drawn over it, at the left and right edges.
in property <int> volume: 100;
in property <bool> muted;
in property <float> backdrop-opacity: 0.16;
in property <float> backdrop-left: 0.67;
in property <float> backdrop-right: 0.95;
// True while the cover turns away; the app swaps the cover at edge-on and
// sets it back to false to turn the new one in.
in property <bool> flip-out;
@@ -768,15 +978,15 @@ component NowPlayingView inherits Rectangle {
out property <length> art-size: 440px * Theme.s;
// Blown-up cover as a dim backdrop.
if root.has-cover: Image {
if root.has-cover && root.backdrop-opacity > 0: Image {
width: parent.width;
height: parent.height;
source: root.cover;
image-fit: ImageFit.cover;
opacity: 0.16;
opacity: root.backdrop-opacity;
}
Rectangle {
background: @linear-gradient(90deg, Theme.bg.with-alpha(0.67), Theme.bg.with-alpha(0.95));
background: @linear-gradient(90deg, Theme.bg.with-alpha(root.backdrop-left), Theme.bg.with-alpha(root.backdrop-right));
}
HorizontalLayout {
@@ -841,12 +1051,17 @@ component NowPlayingView inherits Rectangle {
font-size: 14px * Theme.s;
color: Theme.muted;
}
Text {
// Sized below the time text, so the row keeps the text's height.
HorizontalLayout {
horizontal-stretch: 1;
text: root.has-track ? (root.paused ? "Paused" : "Playing") : "";
font-size: 14px * Theme.s;
color: Theme.highlight;
horizontal-alignment: center;
alignment: center;
if root.has-track: VerticalLayout {
alignment: center;
PlayState {
paused: root.paused;
size: 11px * Theme.s;
}
}
}
Text {
text: root.duration;
@@ -854,6 +1069,13 @@ component NowPlayingView inherits Rectangle {
color: Theme.muted;
}
}
HorizontalLayout {
alignment: center;
VolumeLevel {
level: root.volume;
muted: root.muted;
}
}
}
VerticalLayout {
@@ -924,6 +1146,7 @@ export component AppWindow inherits Window {
in property <int> login-focus;
in property <string> login-error;
in property <bool> login-busy;
in property <bool> login-can-cancel;
// Browse
in property <[string]> sections;
@@ -956,6 +1179,9 @@ export component AppWindow inherits Window {
in property <string> np-duration;
in property <bool> np-paused;
in property <bool> np-flip-out;
in property <float> np-backdrop-opacity: 0.16;
in property <float> np-backdrop-left: 0.67;
in property <float> np-backdrop-right: 0.95;
in property <[Item]> queue-items;
in property <int> queue-count;
in property <int> queue-selected;
@@ -963,7 +1189,12 @@ export component AppWindow inherits Window {
in property <[Hint]> hints;
in property <string> toast;
// The volume overlay, shown briefly after any volume change.
in property <bool> volume-shown;
in property <int> volume;
in property <bool> muted;
in property <string> version;
in property <bool> show-hint-bar: true;
public function focus-main() {
fs.focus();
@@ -1016,6 +1247,10 @@ export component AppWindow inherits Window {
if (e.text == "f") { root.action(Action.now-playing); return accept; }
if (e.text == ",") { root.action(Action.seek-back); return accept; }
if (e.text == ".") { root.action(Action.seek-forward); return accept; }
// = is + without shift on most layouts.
if (e.text == "+" || e.text == "=") { root.action(Action.volume-up); return accept; }
if (e.text == "-") { root.action(Action.volume-down); return accept; }
if (e.text == "m") { root.action(Action.toggle-mute); return accept; }
reject
}
@@ -1035,7 +1270,8 @@ export component AppWindow inherits Window {
error: root.login-error;
busy: root.login-busy;
submit => { root.login-submit(); }
exit => { root.action(Action.quit); }
can-cancel: root.login-can-cancel;
exit => { root.action(root.login-can-cancel ? Action.back : Action.quit); }
field-clicked(i) => { root.login-field-clicked(i); }
}
@@ -1118,6 +1354,11 @@ export component AppWindow inherits Window {
paused: root.np-paused;
has-track: root.np-has-track;
flip-out: root.np-flip-out;
volume: root.volume;
muted: root.muted;
backdrop-opacity: root.np-backdrop-opacity;
backdrop-left: root.np-backdrop-left;
backdrop-right: root.np-backdrop-right;
queue: root.queue-items;
queue-count: root.queue-count;
queue-selected: root.queue-selected;
@@ -1142,6 +1383,14 @@ export component AppWindow inherits Window {
color: Theme.text;
}
}
VolumeOverlay {
x: (parent.width - self.width) / 2;
y: parent.height - self.height - 32px * Theme.s;
shown: root.volume-shown;
level: root.volume;
muted: root.muted;
}
}
if root.screen == Screen.browse: NowBar {
@@ -1156,9 +1405,13 @@ export component AppWindow inherits Window {
progress: root.np-progress;
time: root.np-position + " / " + root.np-duration;
paused: root.np-paused;
volume: root.volume;
muted: root.muted;
}
HintBar {
// Optional, except on the login screen, where the controls are
// not known yet and Settings cannot be reached.
if root.show-hint-bar || root.screen == Screen.login: HintBar {
height: 46px * Theme.s;
hints: root.hints;
version: root.version;
+6
View File
@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M22 42 L26 42 26 32 31 42 33 42 38 32 38 42 42 42 42 22 38 22 32 34 26 22 22 22 22 42 M16 8 L48 8 Q56 8 56 16 L56 48 Q56 56 48 56 L16 56 Q8 56 8 48 L8 16 Q8 8 16 8"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 345 B

+6
View File
@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M16 8 L48 8 Q56 8 56 16 L56 48 Q56 56 48 56 L16 56 Q8 56 8 48 L8 16 Q8 8 16 8 M40 30 L24 30 24 34 40 34 40 30"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 291 B

+6
View File
@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M40 30 L34 30 34 24 30 24 30 30 24 30 24 34 30 34 30 40 34 40 34 34 40 34 40 30 M16 8 L48 8 Q56 8 56 16 L56 48 Q56 52.9 53 54.8 51.1 56 48 56 L16 56 Q12.9 56 11 54.8 8 52.9 8 48 L8 16 Q8 8 16 8"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 375 B

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 18.5 10.85 22.75 9.45 L26.15 12.95 Q21.25 14.05 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 23.45 42.5 32 42.5 40.55 42.5 46.55 37.7 L46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 42.75 14.05 37.9 12.95 L41.25 9.45 Q45.5 10.85 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.05 37 32 37 24.85 37 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q23.65 16.05 28.4 15.3 L28.7 15.6 Q30 17 32 17 33.85 17.05 35.3 15.65 L35.3 15.6 35.6 15.3 Q40.5 16.05 44.2 19 L44.15 19 M30.85 13.5 L24.45 6.85 Q24 6.35 24 5.65 24 4.95 24.45 4.5 24.9 4 25.6 4 L38.4 4 Q39.05 4 39.55 4.5 40 4.95 40 5.65 40 6.35 39.55 6.85 L33.15 13.5 Q32.65 14 32 14 31.3 14 30.85 13.5 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 17.8 11.4 21 10.1 L21 10.35 Q21 12.25 22.25 13.5 L22.75 14 Q19.85 15.15 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 L21.25 40.15 Q21 40.8 21 41.65 21 43.5 22.25 44.85 L22.3 44.95 28.7 51.6 Q30 53 32 53 33.85 53.05 35.3 51.65 L35.3 51.6 41.7 44.95 41.8 44.85 Q43 43.5 43 41.65 L42.8 40.15 46.55 37.7 46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 44.1 15.15 41.3 14 L41.7 13.6 Q43 12.35 43 10.35 L43 10.1 Q46.2 11.4 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.35 36.75 32.8 37 L31.2 37 Q24.55 36.75 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q24.7 15.2 31.2 15 L32.8 15 Q39.45 15.25 44.2 19 L44.15 19 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30.85 2.5 Q31.3 2 32 2 32.65 2 33.15 2.5 L39.55 9.15 Q40 9.65 40 10.35 40 11.05 39.55 11.5 39.05 12 38.4 12 L25.6 12 Q24.9 12 24.45 11.5 24 11.05 24 10.35 24 9.65 24.45 9.15 L30.85 2.5 M30.85 49.5 L24.45 42.85 Q24 42.35 24 41.65 L24.05 41.3 24.45 40.5 Q24.9 40 25.6 40 L38.4 40 Q39.05 40 39.55 40.5 L40 41.3 40 41.65 Q40 42.35 39.55 42.85 L33.15 49.5 Q32.65 50 32 50 31.3 50 30.85 49.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 18.5 10.85 22.75 9.45 L26.15 12.95 Q21.25 14.05 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 23.45 42.5 32 42.5 40.55 42.5 46.55 37.7 L46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 42.75 14.05 37.9 12.95 L41.25 9.45 Q45.5 10.85 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.05 37 32 37 24.85 37 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q23.65 16.05 28.4 15.3 L28.7 15.6 Q30 17 32 17 33.85 17.05 35.3 15.65 L35.3 15.6 35.6 15.3 Q40.5 16.05 44.2 19 L44.15 19 M30.85 13.5 L24.45 6.85 Q24 6.35 24 5.65 24 4.95 24.45 4.5 24.9 4 25.6 4 L38.4 4 Q39.05 4 39.55 4.5 40 4.95 40 5.65 40 6.35 39.55 6.85 L33.15 13.5 Q32.65 14 32 14 31.3 14 30.85 13.5 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 17.8 11.4 21 10.1 L21 10.35 Q21 12.25 22.25 13.5 L22.75 14 Q19.85 15.15 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 L21.25 40.15 Q21 40.8 21 41.65 21 43.5 22.25 44.85 L22.3 44.95 28.7 51.6 Q30 53 32 53 33.85 53.05 35.3 51.65 L35.3 51.6 41.7 44.95 41.8 44.85 Q43 43.5 43 41.65 L42.8 40.15 46.55 37.7 46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 44.1 15.15 41.3 14 L41.7 13.6 Q43 12.35 43 10.35 L43 10.1 Q46.2 11.4 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.35 36.75 32.8 37 L31.2 37 Q24.55 36.75 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q24.7 15.2 31.2 15 L32.8 15 Q39.45 15.25 44.2 19 L44.15 19 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30.85 2.5 Q31.3 2 32 2 32.65 2 33.15 2.5 L39.55 9.15 Q40 9.65 40 10.35 40 11.05 39.55 11.5 39.05 12 38.4 12 L25.6 12 Q24.9 12 24.45 11.5 24 11.05 24 10.35 24 9.65 24.45 9.15 L30.85 2.5 M30.85 49.5 L24.45 42.85 Q24 42.35 24 41.65 L24.05 41.3 24.45 40.5 Q24.9 40 25.6 40 L38.4 40 Q39.05 40 39.55 40.5 L40 41.3 40 41.65 Q40 42.35 39.55 42.85 L33.15 49.5 Q32.65 50 32 50 31.3 50 30.85 49.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 18.5 10.85 22.75 9.45 L26.15 12.95 Q21.25 14.05 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 23.45 42.5 32 42.5 40.55 42.5 46.55 37.7 L46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 42.75 14.05 37.9 12.95 L41.25 9.45 Q45.5 10.85 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.05 37 32 37 24.85 37 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q23.65 16.05 28.4 15.3 L28.7 15.6 Q30 17 32 17 33.85 17.05 35.3 15.65 L35.3 15.6 35.6 15.3 Q40.5 16.05 44.2 19 L44.15 19 M30.85 13.5 L24.45 6.85 Q24 6.35 24 5.65 24 4.95 24.45 4.5 24.9 4 25.6 4 L38.4 4 Q39.05 4 39.55 4.5 40 4.95 40 5.65 40 6.35 39.55 6.85 L33.15 13.5 Q32.65 14 32 14 31.3 14 30.85 13.5 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 17.8 11.4 21 10.1 L21 10.35 Q21 12.25 22.25 13.5 L22.75 14 Q19.85 15.15 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 L21.25 40.15 Q21 40.8 21 41.65 21 43.5 22.25 44.85 L22.3 44.95 28.7 51.6 Q30 53 32 53 33.85 53.05 35.3 51.65 L35.3 51.6 41.7 44.95 41.8 44.85 Q43 43.5 43 41.65 L42.8 40.15 46.55 37.7 46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 44.1 15.15 41.3 14 L41.7 13.6 Q43 12.35 43 10.35 L43 10.1 Q46.2 11.4 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.35 36.75 32.8 37 L31.2 37 Q24.55 36.75 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q24.7 15.2 31.2 15 L32.8 15 Q39.45 15.25 44.2 19 L44.15 19 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30.85 2.5 Q31.3 2 32 2 32.65 2 33.15 2.5 L39.55 9.15 Q40 9.65 40 10.35 40 11.05 39.55 11.5 39.05 12 38.4 12 L25.6 12 Q24.9 12 24.45 11.5 24 11.05 24 10.35 24 9.65 24.45 9.15 L30.85 2.5 M30.85 49.5 L24.45 42.85 Q24 42.35 24 41.65 L24.05 41.3 24.45 40.5 Q24.9 40 25.6 40 L38.4 40 Q39.05 40 39.55 40.5 L40 41.3 40 41.65 Q40 42.35 39.55 42.85 L33.15 49.5 Q32.65 50 32 50 31.3 50 30.85 49.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

+6
View File
@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 18.5 10.85 22.75 9.45 L26.15 12.95 Q21.25 14.05 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 23.45 42.5 32 42.5 40.55 42.5 46.55 37.7 L46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 42.75 14.05 37.9 12.95 L41.25 9.45 Q45.5 10.85 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.05 37 32 37 24.85 37 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q23.65 16.05 28.4 15.3 L28.7 15.6 Q30 17 32 17 33.85 17.05 35.3 15.65 L35.3 15.6 35.6 15.3 Q40.5 16.05 44.2 19 L44.15 19 M30.85 13.5 L24.45 6.85 Q24 6.35 24 5.65 24 4.95 24.45 4.5 24.9 4 25.6 4 L38.4 4 Q39.05 4 39.55 4.5 40 4.95 40 5.65 40 6.35 39.55 6.85 L33.15 13.5 Q32.65 14 32 14 31.3 14 30.85 13.5 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M43 50 Q43 52.5 39.75 54.25 36.55 56 32 56 27.5 56 24.25 54.25 21 52.5 21 50 L21 47.9 Q17.8 46.55 15 44.3 8 38.7 8 30.65 L8 30.1 8 29.55 8 29 8 28.5 8 28.1 8 27.95 8 27.4 Q8 19.4 15 13.65 17.8 11.4 21 10.1 L21 10.35 Q21 12.25 22.25 13.5 L22.75 14 Q19.85 15.15 17.4 17.1 L17.45 17.1 Q12.15 21.4 12 27.4 12.1 33.45 17.4 37.65 L21.25 40.15 Q21 40.8 21 41.65 21 43.5 22.25 44.85 L22.3 44.95 28.7 51.6 Q30 53 32 53 33.85 53.05 35.3 51.65 L35.3 51.6 41.7 44.95 41.8 44.85 Q43 43.5 43 41.65 L42.8 40.15 46.55 37.7 46.6 37.65 Q51.9 33.4 52 27.4 51.85 21.4 46.55 17.1 44.1 15.15 41.3 14 L41.7 13.6 Q43 12.35 43 10.35 L43 10.1 Q46.2 11.4 48.95 13.65 56 19.4 56 27.4 L56 27.95 56 28.1 56 28.5 56 29 56 29.55 56 30.1 56 30.65 Q56 38.7 48.95 44.3 46.2 46.55 43 47.9 L43 50 M44.15 19 Q47.7 22 48 25.95 L48 26.05 Q47.7 30 44.2 32.9 L44 33.05 Q39.35 36.75 32.8 37 L31.2 37 Q24.55 36.75 19.8 32.95 L19.7 32.9 Q16.3 30 16 26.1 L16 26.05 Q16.25 22 19.85 19 L19.95 18.9 Q24.7 15.2 31.2 15 L32.8 15 Q39.45 15.25 44.2 19 L44.15 19 M30 27 L30 23 33 23 Q33.85 23 34.4 23.55 35 24.15 35 25 35 25.85 34.4 26.4 33.85 27 33.05 27 L30 27 M33 30 L34 29.9 34 30 35 33 38 33 36.5 28.5 Q38 27.05 38 25 38 22.95 36.5 21.45 35.05 20 33 20 L27 20 27 33 30 33 30 30 33 30 M30.85 2.5 Q31.3 2 32 2 32.65 2 33.15 2.5 L39.55 9.15 Q40 9.65 40 10.35 40 11.05 39.55 11.5 39.05 12 38.4 12 L25.6 12 Q24.9 12 24.45 11.5 24 11.05 24 10.35 24 9.65 24.45 9.15 L30.85 2.5 M30.85 49.5 L24.45 42.85 Q24 42.35 24 41.65 L24.05 41.3 24.45 40.5 Q24.9 40 25.6 40 L38.4 40 Q39.05 40 39.55 40.5 L40 41.3 40 41.65 Q40 42.35 39.55 42.85 L33.15 49.5 Q32.65 50 32 50 31.3 50 30.85 49.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB