Added logs. MPRIS, UI changes

This commit is contained in:
Ultradesu
2026-06-10 16:23:20 +01:00
parent 39b955b6e7
commit 4f39d04677
13 changed files with 1020 additions and 75 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
# Default keybindings for furumi-cli.
# Default keybindings for furumi.
#
# To customize, copy entries into <config dir>/furumi/keymap.toml
# (~/.config/furumi/keymap.toml on Linux/macOS). A user binding replaces the
@@ -47,6 +47,10 @@ command = { GoToTab = 2 }
key_sequence = "4"
command = { GoToTab = 3 }
[[keymaps]]
key_sequence = "5"
command = { GoToTab = 4 }
[[keymaps]]
key_sequence = "a"
command = "QueueAddNext"
+2
View File
@@ -21,6 +21,7 @@ pub enum KeyContext {
Playlists,
Queue,
Devices,
Logs,
}
impl KeyContext {
@@ -32,6 +33,7 @@ impl KeyContext {
KeyContext::Playlists => "playlists",
KeyContext::Queue => "queue",
KeyContext::Devices => "devices",
KeyContext::Logs => "logs",
}
}
}
+14 -8
View File
@@ -129,11 +129,17 @@ fn hms_now() -> String {
pub fn init() -> Result<()> {
let buffer = Arc::new(LogBuffer::default());
let _ = BUFFER.set(Arc::clone(&buffer));
let memory_layer = MemoryLayer { buffer }.with_filter(
tracing_subscriber::filter::Targets::new()
.with_default(LevelFilter::INFO)
.with_target("furumi_cli", LevelFilter::TRACE),
);
fn memory_layer<S>(buffer: Arc<LogBuffer>) -> impl tracing_subscriber::Layer<S>
where
S: tracing::Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>,
{
MemoryLayer { buffer }.with_filter(
tracing_subscriber::filter::Targets::new()
.with_default(LevelFilter::INFO)
.with_target(env!("CARGO_CRATE_NAME"), LevelFilter::TRACE),
)
}
match open_log_file() {
Ok(file) => {
@@ -146,13 +152,13 @@ pub fn init() -> Result<()> {
.with_filter(filter);
tracing_subscriber::registry()
.with(file_layer)
.with(memory_layer)
.with(memory_layer(buffer))
.init();
tracing::info!(version = env!("CARGO_PKG_VERSION"), "furumi-cli starting");
tracing::info!(version = env!("CARGO_PKG_VERSION"), "furumi starting");
Ok(())
}
Err(err) => {
tracing_subscriber::registry().with(memory_layer).init();
tracing_subscriber::registry().with(memory_layer(buffer)).init();
tracing::warn!(%err, "log file unavailable, in-app logs only");
Err(err)
}