Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Linux: file dialogs that never open, file drops, startup with no audio output (#325)

Chris Laupama8f5b700cf8e5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44cd01a1..941e8faf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,18 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
at full detail instead of in blocks.
### Fixed
+- **Linux: file dialogs that never open** (nota-daw/nota#297): when xdg-desktop-portal has no
+ working FileChooser backend, Open / Save / Export / Import used to do nothing. Nota now notices
+ within 4 seconds (the request fails, answers without showing, or shows nothing) and opens its
+ own file chooser instead, for the rest of the session. `NOTA_FILE_DIALOG=builtin` uses it from
+ the start.
+- **Linux: dropping files from a file manager** (nota-daw/nota#300): besides the standard file
+ list, a drop now also reads file paths sent as text, as a GNOME / KDE copied-files list or as
+ `text/x-moz-url`, wherever files can be dropped. A drop that still names no readable file
+ logs the formats it offered.
+- **Linux: Nota no longer quits at launch when no audio output opens** (nota-daw/nota#243): if
+ the chosen device, its rate or buffer, and the system default all fail, the engine runs on a
+ silent device and the status line says so, instead of aborting before the window appears.
- **History tab shows the first save** (nota-daw/nota#317): with the History tab open, the first
save of a new project (and Save as…) now lists its version straight away instead of after a
tab switch.
diff --git a/src/managed/Nota.App/BrowserView.cs b/src/managed/Nota.App/BrowserView.cs
index c754ea71..011140ee 100644
--- a/src/managed/Nota.App/BrowserView.cs
+++ b/src/managed/Nota.App/BrowserView.cs
@@ -16,6 +16,8 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
+using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
@@ -28,8 +30,10 @@ using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform.Storage;
using Nota.Application;
+using Nota.Application.Input;
using Nota.Application.Samples;
using Nota.Presentation;
+using Microsoft.Extensions.DependencyInjection;
namespace Nota.App;
@@ -76,26 +80,49 @@ public sealed class BrowserView : UserControl
/// or an external drag that carries file(s). Lenient by design — used in DragOver,
/// where some backends don't expose the file list yet; the drop re-checks.</summary>
public static bool IsAcceptableDrag(DragEventArgs e)
- => IsBrowserDrag || e.DataTransfer.Contains(DataFormat.File);
+ => IsBrowserDrag || e.DataTransfer.Contains(DataFormat.File) || HasPathText(e.DataTransfer);
- /// <summary>Local paths of the audio / MIDI files carried by an external drag (empty
- /// if none / not a file drag).</summary>
- private static List<string> ExternalFiles(DragEventArgs e)
+ // A drag that may name files without Avalonia's file list (#300): plain text or a
+ // file manager's own URI list. The drop parses it and ignores anything else.
+ private static bool HasPathText(IDataTransfer data)
+ => data.Formats.Any(f => f.Equals(DataFormat.Text) || UriListFormat(f) is not null);
+
+ private static DataFormat<byte[]>? UriListFormat(DataFormat f)
+ => f is DataFormat<byte[]> b && f.Kind == DataFormatKind.Platform
+ && DroppedFilePaths.UriListMimeTypes.Contains(f.Identifier) ? b : null;
+
+ /// <summary>Local paths (files or folders) an external drag carries: Avalonia's file
+ /// list, or when it has none (some sources / bridges on Linux, #300) the paths parsed
+ /// from its text or URI-list formats.</summary>
+ internal static List<string> ExternalPaths(DragEventArgs e)
{
var paths = new List<string>();
- if (!e.DataTransfer.Contains(DataFormat.File)) return paths;
- var files = e.DataTransfer.TryGetFiles();
- if (files is null) return paths;
- foreach (var f in files)
- {
- var p = f.TryGetLocalPath();
- if (!string.IsNullOrEmpty(p)
- && (AudioExts.Contains(System.IO.Path.GetExtension(p)) || Nota.Application.Midi.MidiFileReader.IsMidiFile(p)))
- paths.Add(p!);
+ var data = e.DataTransfer;
+ if (data.Contains(DataFormat.File) && data.TryGetFiles() is { } files)
+ foreach (var f in files)
+ if (f.TryGetLocalPath() is { Length: > 0 } p) paths.Add(p);
+ if (paths.Count > 0 || IsBrowserDrag) return paths;
+ foreach (var f in data.Formats)
+ {
+ string? text = f.Equals(DataFormat.Text) ? data.TryGetText()
+ : UriListFormat(f) is { } b ? DroppedFilePaths.Decode(data.TryGetValue(b))
+ : null;
+ if (text is null || text == DragSentinel) continue;
+ foreach (var p in DroppedFilePaths.Parse(text))
+ if ((File.Exists(p) || Directory.Exists(p)) && !paths.Contains(p)) paths.Add(p);
}
+ if (paths.Count == 0)
+ App.Services.GetService<ILogSink>()?.Info(
+ $"External drop named no files Nota can read. Formats: {string.Join(", ", data.Formats.Select(f => $"{f.Kind}:{f.Identifier}"))}");
return paths;
}
+ /// <summary>Local paths of the audio / MIDI files carried by an external drag (empty
+ /// if none / not a file drag).</summary>
+ private static List<string> ExternalFiles(DragEventArgs e)
+ => ExternalPaths(e).Where(p => AudioExts.Contains(System.IO.Path.GetExtension(p))
+ || Nota.Application.Midi.MidiFileReader.IsMidiFile(p)).ToList();
+
/// <summary>The items a drop should load: the internal browser item (any kind), or
/// one synthesized Sample / MidiFile item per external file. Empty when there's nothing
/// we can use (e.g. an unsupported external file). Callers that take one use [0].</summary>
diff --git a/src/managed/Nota.App/DeviceCards/Bodies/ChamberDeviceBody.cs b/src/managed/Nota.App/DeviceCards/Bodies/ChamberDeviceBody.cs
index 414afd8a..488e2674 100644
--- a/src/managed/Nota.App/DeviceCards/Bodies/ChamberDeviceBody.cs
+++ b/src/managed/Nota.App/DeviceCards/Bodies/ChamberDeviceBody.cs
@@ -250,7 +250,7 @@ internal sealed class ChamberDeviceBody : IDeviceBody
{
var top = TopLevel.GetTopLevel(anchor);
if (top is null) return;
- var files = await top.StorageProvider.OpenFilePickerAsync(new Avalonia.Platform.Storage.FilePickerOpenOptions
+ var files = await top.PickFilesAsync(new Avalonia.Platform.Storage.FilePickerOpenOptions
{
Title = "Load impulse response", AllowMultiple = false,
FileTypeFilter = new[] { new Avalonia.Platform.Storage.FilePickerFileType("Impulse response") { Patterns = new[] { "*.wav", "*.wave", "*.flac", "*.mp3" } } },
diff --git a/src/managed/Nota.App/DeviceCards/Bodies/LensDeviceBody.cs b/src/managed/Nota.App/DeviceCards/Bodies/LensDeviceBody.cs
index d8324540..7f0656d0 100644
--- a/src/managed/Nota.App/DeviceCards/Bodies/LensDeviceBody.cs
+++ b/src/managed/Nota.App/DeviceCards/Bodies/LensDeviceBody.cs
@@ -516,7 +516,7 @@ internal sealed class LensDeviceBody : IDeviceBody
var raw = new float[65536];
int n = engine.DeviceLayerWave(track, di, L_Raw, raw, raw.Length);
if (n <= 0) return;
- var file = await top.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
+ var file = await top.PickSaveFileAsync(new FilePickerSaveOptions
{
Title = "Export the Lens capture to WAV",
DefaultExtension = "wav",
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/MosaicInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/MosaicInstrumentCard.cs
index a2c54d92..8fcf1227 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/MosaicInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/MosaicInstrumentCard.cs
@@ -478,7 +478,7 @@ internal sealed class MosaicInstrumentCard : IInstrumentCard
{
var top = TopLevel.GetTopLevel(map);
if (top is null) return;
- var picked = await top.StorageProvider.OpenFolderPickerAsync(new Avalonia.Platform.Storage.FolderPickerOpenOptions { Title = "Locate the samples", AllowMultiple = false });
+ var picked = await top.PickFoldersAsync(new Avalonia.Platform.Storage.FolderPickerOpenOptions { Title = "Locate the samples", AllowMultiple = false });
var dir = picked.FirstOrDefault()?.TryGetLocalPath();
if (dir is null) return;
var byName = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -1314,7 +1314,7 @@ internal sealed class MosaicInstrumentCard : IInstrumentCard
var item = BrowserView.CurrentDrag;
bool folder = item is { Kind: BrowserItemKind.Folder } && Directory.Exists(item.Path);
bool sample = item is { Kind: BrowserItemKind.Sample };
- bool files = item is null && e.DataTransfer.Contains(DataFormat.File);
+ bool files = item is null && BrowserView.IsAcceptableDrag(e);
if (!folder && !sample && !files) return;
e.DragEffects = DragDropEffects.Copy;
e.Handled = true;
@@ -1398,15 +1398,7 @@ internal sealed class MosaicInstrumentCard : IInstrumentCard
}
}
- private static List<string> DroppedPaths(DragEventArgs e)
- {
- var list = new List<string>();
- if (!e.DataTransfer.Contains(DataFormat.File)) return list;
- var files = e.DataTransfer.TryGetFiles();
- if (files is null) return list;
- foreach (var f in files) if (f.TryGetLocalPath() is { Length: > 0 } p) list.Add(p);
- return list;
- }
+ private static List<string> DroppedPaths(DragEventArgs e) => BrowserView.ExternalPaths(e);
private static List<string> ExpandAudio(IEnumerable<string> paths)
{
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/RhythmInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/RhythmInstrumentCard.cs
index d39b2ef3..ea0d110d 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/RhythmInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/RhythmInstrumentCard.cs
@@ -205,7 +205,7 @@ internal sealed class RhythmInstrumentCard : IInstrumentCard
{
var topLevel = TopLevel.GetTopLevel(anchor);
if (topLevel is null) return;
- var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
+ var files = await topLevel.PickFilesAsync(new FilePickerOpenOptions
{
Title = $"Load a sample into {RM.VoiceNames[voice]}", AllowMultiple = false,
FileTypeFilter = new[] { new FilePickerFileType("Audio") { Patterns = new[] { "*.wav", "*.flac", "*.mp3", "*.aif", "*.aiff", "*.ogg" } } },
diff --git a/src/managed/Nota.App/LinuxFileDialogs.cs b/src/managed/Nota.App/LinuxFileDialogs.cs
new file mode 100644
index 00000000..9dddfef6
--- /dev/null
+++ b/src/managed/Nota.App/LinuxFileDialogs.cs
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// File dialogs that always open on Linux (#297). Avalonia asks xdg-desktop-portal first;
+// when the portal is installed but has no working FileChooser backend (tiling WMs, minimal
+// installs, mismatched portals) the request fails, returns nothing at once, or never
+// answers — and no dialog appears. Here each picker tries the system dialog and falls back
+// to Avalonia's built-in chooser when it throws, comes back empty without ever showing, or
+// shows nothing within a few seconds. After one failure the session goes straight to the
+// built-in chooser. NOTA_FILE_DIALOG=builtin forces it from the start. Every picker in the
+// app goes through PickFilesAsync / PickSaveFileAsync / PickFoldersAsync.
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Dialogs;
+using Avalonia.Platform.Storage;
+using Microsoft.Extensions.DependencyInjection;
+using Nota.Application;
+
+namespace Nota.App;
+
+internal static class LinuxFileDialogs
+{
+ /// <summary>How long a system picker may take to show before it counts as broken.</summary>
+ internal static readonly TimeSpan ShowTimeout = TimeSpan.FromSeconds(4);
+
+ // Set once a system picker failed: the rest of the session uses the built-in one.
+ internal static bool SystemBroken { get; set; } =
+ string.Equals(Environment.GetEnvironmentVariable("NOTA_FILE_DIALOG"), "builtin", StringComparison.OrdinalIgnoreCase);
+
+ // On Linux TopLevel.StorageProvider is the built-in chooser (UseManagedSystemDialogs), and
+ // the pickers below try the system one (the platform's own provider) first.
+ private static bool _enabled;
+
+ public static AppBuilder WithLinuxFileDialogFallback(this AppBuilder builder)
+ {
+ if (!OperatingSystem.IsLinux()) return builder;
+ _enabled = true;
+ return builder.UseManagedSystemDialogs();
+ }
+
+ /// <summary>Open-file picker that falls back to the built-in chooser on Linux.</summary>
+ public static Task<IReadOnlyList<IStorageFile>> PickFilesAsync(this TopLevel top, FilePickerOpenOptions options)
+ => Picker(top, p => p.OpenFilePickerAsync(options), r => r.Count == 0);
+
+ /// <summary>Save-file picker that falls back to the built-in chooser on Linux.</summary>
+ public static Task<IStorageFile?> PickSaveFileAsync(this TopLevel top, FilePickerSaveOptions options)
+ => Picker(top, p => p.SaveFilePickerAsync(options), r => r is null);
+
+ /// <summary>Folder picker that falls back to the built-in chooser on Linux.</summary>
+ public static Task<IReadOnlyList<IStorageFolder>> PickFoldersAsync(this TopLevel top, FolderPickerOpenOptions options)
+ => Picker(top, p => p.OpenFolderPickerAsync(options), r => r.Count == 0);
+
+ // Runs the system picker; if it throws, answers "nothing" without ever having taken the
+ // focus, or doesn't take the focus within ShowTimeout, the built-in one runs instead.
+ private static async Task<T> Picker<T>(TopLevel top, Func<IStorageProvider, Task<T>> open, Func<T, bool> isEmpty)
+ {
+ var builtin = top.StorageProvider;
+ if (!_enabled || top.PlatformImpl?.TryGetFeature<IStorageProvider>() is not { } system)
+ return await open(builtin); // not Linux: StorageProvider is the system dialog
+ if (SystemBroken) return await open(builtin);
+ var window = top as Window;
+ bool shown = false;
+ void OnDeactivated(object? s, EventArgs e) => shown = true;
+ if (window is not null) window.Deactivated += OnDeactivated;
+ try
+ {
+ var task = open(system);
+ bool finished = await Task.WhenAny(task, Task.Delay(ShowTimeout)) == task;
+ var result = finished ? await task : default!; // rethrows a failed request
+ bool active = window?.IsActive ?? false; // no window to watch: trust the dialog
+ return FileDialogFallback.Decide(finished, finished && isEmpty(result), shown, active) switch
+ {
+ FileDialogFallback.Verdict.Keep => result,
+ FileDialogFallback.Verdict.Wait => await WaitForDialog(task),
+ _ => await Broken(finished ? "the system file dialog answered without showing"
+ : $"the system file dialog didn't open within {ShowTimeout.TotalSeconds:0} s"),
+ };
+ }
+ catch (Exception ex) when (ex is not OperationCanceledException)
+ {
+ return await Broken($"the system file dialog failed: {ex.Message}");
+ }
+ finally
+ {
+ if (window is not null) window.Deactivated -= OnDeactivated;
+ }
+
+ // A dialog seems up: wait for the user. But the focus may have gone to another app
+ // instead; if the window has the focus back for ShowTimeout and the request is still
+ // open, nothing is showing, so the built-in chooser takes over.
+ async Task<T> WaitForDialog(Task<T> pending)
+ {
+ var activeSince = DateTime.MinValue;
+ while (true)
+ {
+ if (await Task.WhenAny(pending, Task.Delay(250)) == pending) return await pending;
+ bool active = window?.IsActive ?? false;
+ if (!active) activeSince = DateTime.MinValue;
+ else if (activeSince == DateTime.MinValue) activeSince = DateTime.UtcNow;
+ var activeFor = active ? DateTime.UtcNow - activeSince : TimeSpan.Zero;
+ if (FileDialogFallback.WhileWaiting(false, activeFor, ShowTimeout) == FileDialogFallback.Verdict.Fallback)
+ return await Broken($"the system file dialog didn't open within {ShowTimeout.TotalSeconds:0} s");
+ }
+ }
+
+ Task<T> Broken(string why)
+ {
+ SystemBroken = true;
+ App.Services?.GetService<ILogSink>()?.Warn(
+ $"Using Nota's built-in file dialog: {why}. Check xdg-desktop-portal and its FileChooser backend.");
+ return open(builtin);
+ }
+ }
+}
diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.cs
index 9fbafee5..72ce27bb 100644
--- a/src/managed/Nota.App/MainWindow.Files.cs
+++ b/src/managed/Nota.App/MainWindow.Files.cs
@@ -29,7 +29,7 @@ public partial class MainWindow
// native file panel opens (common under `dotnet run` / launched from an IDE), the
// panel can appear unfocused and refuse clicks. Activating makes the window key.
Activate();
- var files = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
+ var files = await this.PickFilesAsync(new FilePickerOpenOptions
{
Title = "Import audio",
AllowMultiple = false,
@@ -76,7 +76,7 @@ public partial class MainWindow
string? path;
if (opts.Stems)
{
- var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
+ var folders = await this.PickFoldersAsync(new FolderPickerOpenOptions
{
Title = "Export stems to folder", AllowMultiple = false,
});
@@ -84,7 +84,7 @@ public partial class MainWindow
}
else
{
- var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
+ var file = await this.PickSaveFileAsync(new FilePickerSaveOptions
{
Title = $"Export master to {ext.ToUpperInvariant()}",
DefaultExtension = ext,
@@ -221,7 +221,7 @@ public partial class MainWindow
{
if (_vm is null) return;
Activate(); // keep the native panel focused (see DoImportAsync)
- var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
+ var folders = await this.PickFoldersAsync(new FolderPickerOpenOptions
{
Title = "Open Nota project (.nota folder)",
AllowMultiple = false,
@@ -376,7 +376,7 @@ public partial class MainWindow
private async Task<string?> PickProjectPathAsync(string title, string suggestedName)
{
Activate();
- var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
+ var file = await this.PickSaveFileAsync(new FilePickerSaveOptions
{
Title = title,
SuggestedStartLocation = _vm is null ? null : await FolderAsync(_vm.Settings.ResolvedProjectsFolder()), // #309
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index 2efd7c19..eadfa1ea 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -681,7 +681,7 @@ public sealed partial class PreferencesWindow : NotaWindow
addBtn.Click += async (_, _) =>
{
Activate();
- var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { Title = "Add plugin scan folder", AllowMultiple = false });
+ var folders = await this.PickFoldersAsync(new FolderPickerOpenOptions { Title = "Add plugin scan folder", AllowMultiple = false });
if (folders.Count == 0) return;
var path = folders[0].TryGetLocalPath();
if (path is null) return;
@@ -785,7 +785,7 @@ public sealed partial class PreferencesWindow : NotaWindow
choose.Click += async (_, _) =>
{
Activate();
- var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { Title = $"Choose {label} folder", AllowMultiple = false });
+ var folders = await this.PickFoldersAsync(new FolderPickerOpenOptions { Title = $"Choose {label} folder", AllowMultiple = false });
if (folders.Count == 0) return;
var p = folders[0].TryGetLocalPath();
if (p is null) return;
diff --git a/src/managed/Nota.App/Program.cs b/src/managed/Nota.App/Program.cs
index 05f83af3..b99b0817 100644
--- a/src/managed/Nota.App/Program.cs
+++ b/src/managed/Nota.App/Program.cs
@@ -23,6 +23,7 @@ class Program
.WithDeveloperTools()
#endif
.WithNotaFonts()
+ .WithLinuxFileDialogFallback()
.LogToTrace()
.WithImeLogNoiseFiltered();
}
diff --git a/src/managed/Nota.Application/Engine/IAudioEngine.cs b/src/managed/Nota.Application/Engine/IAudioEngine.cs
index bb5284b0..87b4b492 100644
--- a/src/managed/Nota.Application/Engine/IAudioEngine.cs
+++ b/src/managed/Nota.Application/Engine/IAudioEngine.cs
@@ -937,6 +937,8 @@ public interface IAudioEngine : IDisposable
/// <summary>True if the last <see cref="ApplyAudio"/> requested WASAPI exclusive but the device refused
/// it and the backend fell back to shared. Always false on platforms without exclusive mode.</summary>
bool AudioExclusiveFallback { get; }
+ /// <summary>True when no output device opened and the engine runs on a silent stand-in.</summary>
+ bool AudioSilentFallback { get; }
// --- MIDI device settings (M7-2) ---------------------------------------
bool IsMidiInputEnabled(string uid);
diff --git a/src/managed/Nota.Application/FileDialogFallback.cs b/src/managed/Nota.Application/FileDialogFallback.cs
new file mode 100644
index 00000000..3160f4a0
--- /dev/null
+++ b/src/managed/Nota.Application/FileDialogFallback.cs
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// When a Linux system file dialog counts as broken (#297), so Nota opens its built-in one.
+// Pure: the smoke test drives it; Nota.App/LinuxFileDialogs.cs runs the pickers.
+
+namespace Nota.Application;
+
+public static class FileDialogFallback
+{
+ public enum Verdict { Keep, Wait, Fallback }
+
+ /// <summary>What to do with a system picker: <paramref name="finished"/> whether it has
+ /// answered (before the show timeout), <paramref name="empty"/> whether that answer picked
+ /// nothing, <paramref name="shown"/> whether the window lost the focus to a dialog
+ /// meanwhile, <paramref name="windowActive"/> whether the window still has the focus.
+ /// A dialog that took the focus is real (even if the user then cancelled); one that
+ /// answered "nothing" or stayed silent while the window kept the focus never showed.</summary>
+ public static Verdict Decide(bool finished, bool empty, bool shown, bool windowActive)
+ {
+ bool showedSomething = shown || !windowActive;
+ if (finished) return !empty || showedSomething ? Verdict.Keep : Verdict.Fallback;
+ return showedSomething ? Verdict.Wait : Verdict.Fallback;
+ }
+
+ /// <summary>While waiting on a dialog that seemed to show (<see cref="Verdict.Wait"/>):
+ /// the window losing the focus may have been the user switching apps, not a dialog. If
+ /// the request is still open while the window has had the focus back for
+ /// <paramref name="limit"/>, no dialog is in front of it and the request stalled.</summary>
+ public static Verdict WhileWaiting(bool finished, System.TimeSpan activeFor, System.TimeSpan limit)
+ => finished ? Verdict.Keep : activeFor >= limit ? Verdict.Fallback : Verdict.Wait;
+}
diff --git a/src/managed/Nota.Application/Input/DroppedFilePaths.cs b/src/managed/Nota.Application/Input/DroppedFilePaths.cs
new file mode 100644
index 00000000..38941830
--- /dev/null
+++ b/src/managed/Nota.Application/Input/DroppedFilePaths.cs
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Local file paths from the text forms a file drag can arrive in (#300): a text/uri-list,
+// GNOME's x-special/gnome-copied-files ("copy" then URIs), KDE's uri list, or plain text
+// holding file:// URIs or absolute paths, one per line. Used when a drop carries no file
+// list Avalonia could read. Pure: the smoke test drives it directly.
+
+using System;
+using System.Collections.Generic;
+
+namespace Nota.Application.Input;
+
+public static class DroppedFilePaths
+{
+ /// <summary>The drag formats besides Avalonia's file list that can name files.</summary>
+ public static readonly IReadOnlyList<string> UriListMimeTypes = new[]
+ {
+ "x-special/gnome-copied-files", "application/x-kde4-urilist", "text/x-moz-url",
+ };
+
+ /// <summary>The local paths <paramref name="text"/> names, in order, without duplicates.
+ /// Lines that are comments, the gnome "copy" / "cut" header, other URI schemes, remote
+ /// hosts or relative paths are skipped.</summary>
+ public static IReadOnlyList<string> Parse(string? text)
+ {
+ var paths = new List<string>();
+ if (string.IsNullOrEmpty(text)) return paths;
+ foreach (var raw in text.Split(new[] { '\r', '\n', '\0' }, StringSplitOptions.RemoveEmptyEntries))
+ {
+ var line = raw.Trim();
+ if (line.Length == 0 || line[0] == '#' || line is "copy" or "cut") continue;
+ // A plain path keeps its trailing spaces: they can be part of a file name, and a
+ // URI escapes them, so only a URI line is trimmed at the end.
+ string? path = line.StartsWith("file:", StringComparison.OrdinalIgnoreCase) ? FromFileUri(line)
+ : IsAbsolute(line) ? raw.TrimStart()
+ : null;
+ if (path is not null && !paths.Contains(path)) paths.Add(path);
+ }
+ return paths;
+ }
+
+ /// <summary>The text of a drag format's raw bytes: by its byte-order mark when it has
+ /// one, else UTF-16 when it looks like it (text/x-moz-url is), otherwise UTF-8.</summary>
+ public static string Decode(byte[]? bytes)
+ {
+ if (bytes is not { Length: > 0 }) return "";
+ if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) return System.Text.Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2);
+ if (bytes.Length >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF) return System.Text.Encoding.BigEndianUnicode.GetString(bytes, 2, bytes.Length - 2);
+ if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) return System.Text.Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3);
+ bool utf16 = bytes.Length >= 2 && bytes[1] == 0 && bytes[0] != 0;
+ return (utf16 ? System.Text.Encoding.Unicode : System.Text.Encoding.UTF8).GetString(bytes);
+ }
+
+ private static string? FromFileUri(string line)
+ {
+ if (!Uri.TryCreate(line, UriKind.Absolute, out var uri) || !uri.IsFile) return null;
+ // file://host/… names a file on another machine unless the host is this one.
+ if (!string.IsNullOrEmpty(uri.Host) && !uri.Host.Equals("localhost", StringComparison.OrdinalIgnoreCase)
+ && !uri.Host.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase))
+ return null;
+ string path = Uri.UnescapeDataString(uri.AbsolutePath);
+ // file:///C:/x → /C:/x: drop the slash before a Windows drive.
+ if (path.Length >= 3 && path[0] == '/' && char.IsLetter(path[1]) && path[2] == ':') path = path[1..];
+ return path;
+ }
+
+ private static bool IsAbsolute(string line)
+ => line[0] == '/' || (line.Length >= 3 && char.IsLetter(line[0]) && line[1] == ':' && (line[2] == '\\' || line[2] == '/'));
+}
diff --git a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Audio.cs b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Audio.cs
index 27910aa5..75985e63 100644
--- a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Audio.cs
+++ b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Audio.cs
@@ -75,6 +75,9 @@ internal static partial class NativeMethods
[LibraryImport(Lib, EntryPoint = "nota_audio_exclusive_fallback")]
internal static partial int AudioExclusiveFallback(IntPtr engine);
+ [LibraryImport(Lib, EntryPoint = "nota_audio_silent_fallback")]
+ internal static partial int AudioSilentFallback(IntPtr engine);
+
[LibraryImport(Lib, EntryPoint = "nota_midi_refresh_devices")]
internal static partial void MidiRefreshDevices();
diff --git a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Audio.cs b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Audio.cs
index 1f5a74c7..e226175d 100644
--- a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Audio.cs
+++ b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Audio.cs
@@ -89,6 +89,11 @@ public sealed partial class NotaEngine
public bool AudioExclusiveFallback
{ get { ThrowIfDisposed(); return NativeMethods.AudioExclusiveFallback(_handle) != 0; } }
+ /// <summary>True when no output device opened and the engine runs on a silent stand-in
+ /// device: everything works, nothing is heard until a device opens (Settings → Audio).</summary>
+ public bool AudioSilentFallback
+ { get { ThrowIfDisposed(); return NativeMethods.AudioSilentFallback(_handle) != 0; } }
+
// --- MIDI device settings (M7-2) ---
/// <summary>Re-scans connected MIDI input sources.</summary>
diff --git a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
index fa6790f5..5730759f 100644
--- a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
+++ b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
@@ -73,11 +73,15 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
Settings = settings;
_log = log;
- Engine.Start();
+ // No output must not stop Nota from opening (#243): the engine falls back to a silent
+ // device, and if even that fails the app still starts, with audio off.
+ try { Engine.Start(); }
+ catch (NotaEngineException ex) { _log.Error("The audio engine couldn't start", ex); }
Engine.SetBpm(120);
Engine.SetTimeSignature(4, 4);
EngineInfo = $"{Engine.SampleRate:0}\u2009Hz";
_log.Info($"Engine started · {Engine.SampleRate:0}\u2009Hz");
+ if (NoAudioOutput is { } why) { _log.Warn(why); StatusText = why; }
Transport.Message += m => { if (m.Length > 0) StatusText = m; };
@@ -151,6 +155,12 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
EngineInfo = $"{Engine.SampleRate:0}\u2009Hz"; // the version sits beside it, as its own button (#127)
int buf = Engine.NegotiatedBufferFrames;
_log.Info($"Audio applied · {Engine.NegotiatedSampleRate:0}\u2009Hz · {buf} frames");
+ if (NoAudioOutput is { } why)
+ {
+ _log.Warn(why);
+ StatusText = why;
+ return StatusText;
+ }
bool fallback = Engine.AudioExclusiveFallback;
if (fallback)
{
@@ -164,6 +174,13 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
return StatusText;
}
+ /// <summary>Why nothing is heard when no output device opened (the engine runs silently
+ /// or not at all), else null.</summary>
+ public string? NoAudioOutput
+ => !Engine.IsRunning ? "No audio output could be opened — Nota runs without sound. Choose a device in Settings → Audio"
+ : Engine.AudioSilentFallback ? "No audio output device opened — Nota runs silently. Choose a device in Settings → Audio"
+ : null;
+
/// <summary>
/// Applies staged MIDI-input settings (M7-2). Lighter than audio: only the
/// CoreMIDI port is reconnected, the audio backend keeps running, so no
diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.h
index a8f76947..ecfa43c5 100644
--- a/src/native/nota.engine/include/nota/nota_engine.h
+++ b/src/native/nota.engine/include/nota/nota_engine.h
@@ -1963,6 +1963,11 @@ NOTA_API int32_t nota_audio_negotiated_buffer_frames(const NotaEngine* engin
* device refused it and the backend fell back to shared. Always 0 on platforms
* without exclusive mode. */
NOTA_API int32_t nota_audio_exclusive_fallback(const NotaEngine* engine);
+/* True if no output device could be opened (the chosen one, then the system default)
+ * and the engine runs on a silent stand-in device instead: everything works, nothing
+ * is heard. nota_engine_start / nota_audio_apply still return NOTA_OK. Desktop
+ * (miniaudio) backend only; always 0 elsewhere. */
+NOTA_API int32_t nota_audio_silent_fallback(const NotaEngine* engine);
/* --- MIDI device settings (M7-2) ------------------------------------------
* Which CoreMIDI inputs the engine listens to. The chosen set is persisted as a
diff --git a/src/native/nota.engine/src/abi/nota_engine_audio.cpp b/src/native/nota.engine/src/abi/nota_engine_audio.cpp
index 01a6f967..7e58ae51 100644
--- a/src/native/nota.engine/src/abi/nota_engine_audio.cpp
+++ b/src/native/nota.engine/src/abi/nota_engine_audio.cpp
@@ -117,6 +117,9 @@ int32_t nota_audio_negotiated_buffer_frames(const NotaEngine* e) {
int32_t nota_audio_exclusive_fallback(const NotaEngine* e) {
return (e && CENG(e)->audioExclusiveFallback()) ? 1 : 0;
}
+int32_t nota_audio_silent_fallback(const NotaEngine* e) {
+ return (e && CENG(e)->audioSilentFallback()) ? 1 : 0;
+}
} // extern "C"
diff --git a/src/native/nota.engine/src/audio_io/AudioBackend.h b/src/native/nota.engine/src/audio_io/AudioBackend.h
index dfc1bb2b..95275514 100644
--- a/src/native/nota.engine/src/audio_io/AudioBackend.h
+++ b/src/native/nota.engine/src/audio_io/AudioBackend.h
@@ -50,6 +50,11 @@ class AudioBackend {
// that don't model exclusive mode leave it false.
virtual bool exclusiveFallback() const { return false; }
+ // True if no real output device could be opened and the last start() fell back to
+ // a silent device that still runs the audio thread, so the app works (no sound)
+ // until the user picks a device that opens.
+ virtual bool silentFallback() const { return false; }
+
// Stop the audio thread and close the device.
virtual void stop() = 0;
diff --git a/src/native/nota.engine/src/audio_io/desktop/AudioConfig_miniaudio.cpp b/src/native/nota.engine/src/audio_io/desktop/AudioConfig_miniaudio.cpp
index a5f18198..e488a458 100644
--- a/src/native/nota.engine/src/audio_io/desktop/AudioConfig_miniaudio.cpp
+++ b/src/native/nota.engine/src/audio_io/desktop/AudioConfig_miniaudio.cpp
@@ -37,6 +37,9 @@ std::string idToUid(const ma_device_id& id) {
bool enumerate(bool inputScope, std::vector<ma_device_info>& out) {
ma_context ctx;
if (ma_context_init(nullptr, 0, nullptr, &ctx) != MA_SUCCESS) return false;
+ // With no real backend loaded the context lands on the null backend: its stand-in
+ // device is the silent fallback, not something to list or pick.
+ if (ctx.backend == ma_backend_null) { ma_context_uninit(&ctx); return false; }
ma_device_info* playback = nullptr;
ma_uint32 playbackCount = 0;
diff --git a/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.cpp b/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.cpp
index d41aa71e..1099755f 100644
--- a/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.cpp
+++ b/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.cpp
@@ -12,6 +12,8 @@ namespace nota {
struct MiniaudioBackend::Impl {
ma_device device{};
bool deviceInited = false;
+ ma_context nullContext{}; // the silent fallback's context (null backend only)
+ bool nullContextInited = false;
RenderCallback render; // copied from the backend on start()
};
@@ -29,6 +31,7 @@ MiniaudioBackend::MiniaudioBackend() : impl_(new Impl()) {}
MiniaudioBackend::~MiniaudioBackend() {
stop();
+ if (impl_->nullContextInited) ma_context_uninit(&impl_->nullContext);
delete impl_;
}
@@ -36,6 +39,7 @@ bool MiniaudioBackend::start(RenderCallback render, const BackendConfig& cfg) {
if (running_) return true;
impl_->render = std::move(render);
exclusiveFallback_ = false;
+ silentFallback_ = false;
ma_device_id id{};
const bool haveId = notaMiniaudioDeviceIdForIndex(/*inputScope=*/false, cfg.device, id);
@@ -43,9 +47,9 @@ bool MiniaudioBackend::start(RenderCallback render, const BackendConfig& cfg) {
// Build the config once; we re-init if exclusive mode is refused and we
// have to retry in shared mode. miniaudio returns MA_ACCESS_DENIED (device
// in use by another exclusive app) or MA_BUSY for exclusive refusals.
- auto buildConfig = [&](ma_share_mode share) {
+ auto buildConfig = [&](ma_share_mode share, bool useId = true) {
ma_device_config c = ma_device_config_init(ma_device_type_playback);
- c.playback.pDeviceID = haveId ? &id : nullptr; // NULL = system default
+ c.playback.pDeviceID = haveId && useId ? &id : nullptr; // NULL = system default
c.playback.format = ma_format_f32;
c.playback.channels = 2; // interleaved stereo, like the engine
c.playback.shareMode = share;
@@ -66,8 +70,31 @@ bool MiniaudioBackend::start(RenderCallback render, const BackendConfig& cfg) {
config = buildConfig(ma_share_mode_shared);
r = ma_device_init(nullptr, &config, &impl_->device);
}
+ if (r != MA_SUCCESS && (haveId || cfg.sampleRate > 0.0 || cfg.bufferFrames > 0)) {
+ // The chosen device / rate / buffer won't open (unplugged, busy, unsupported):
+ // try the system default as it comes.
+ config = buildConfig(ma_share_mode_shared, /*useId=*/false);
+ config.sampleRate = 0;
+ config.periodSizeInFrames = 0;
+ r = ma_device_init(nullptr, &config, &impl_->device);
+ }
+ // No real output at all (no sound server, no card, broken setup): run on the null
+ // device so the app still starts and works, silently, instead of failing to open.
+ // A default context can also land on the null backend when neither PulseAudio nor
+ // ALSA loads; either way the UI is told.
+ if (r != MA_SUCCESS) {
+ if (!impl_->nullContextInited) {
+ const ma_backend nullOnly[] = {ma_backend_null};
+ impl_->nullContextInited = ma_context_init(nullOnly, 1, nullptr, &impl_->nullContext) == MA_SUCCESS;
+ }
+ if (impl_->nullContextInited) {
+ config = buildConfig(ma_share_mode_shared, /*useId=*/false);
+ r = ma_device_init(&impl_->nullContext, &config, &impl_->device);
+ }
+ }
if (r != MA_SUCCESS) { return false; }
impl_->deviceInited = true;
+ silentFallback_ = impl_->device.pContext != nullptr && impl_->device.pContext->backend == ma_backend_null;
if (ma_device_start(&impl_->device) != MA_SUCCESS) {
stop();
diff --git a/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.h b/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.h
index 574cb828..29ef39ed 100644
--- a/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.h
+++ b/src/native/nota.engine/src/audio_io/desktop/MiniaudioBackend.h
@@ -24,6 +24,7 @@ class MiniaudioBackend final : public AudioBackend {
void setXrunCallback(std::function<void()> cb) override { onXrun_ = std::move(cb); }
bool isRunning() const override { return running_; }
bool exclusiveFallback() const override { return exclusiveFallback_; }
+ bool silentFallback() const override { return silentFallback_; }
// Opaque to callers; public so the file-local data callback can reach it.
struct Impl;
@@ -35,6 +36,7 @@ class MiniaudioBackend final : public AudioBackend {
int32_t bufferFrames_ = 0;
bool running_ = false;
bool exclusiveFallback_ = false; // true if requested exclusive, fell back to shared
+ bool silentFallback_ = false; // true if no output opened and the null device runs instead
};
} // namespace nota
diff --git a/src/native/nota.engine/src/audio_io/desktop/nota_miniaudio.h b/src/native/nota.engine/src/audio_io/desktop/nota_miniaudio.h
index b47a37ed..a475a986 100644
--- a/src/native/nota.engine/src/audio_io/desktop/nota_miniaudio.h
+++ b/src/native/nota.engine/src/audio_io/desktop/nota_miniaudio.h
@@ -32,5 +32,8 @@
#define MA_ENABLE_PULSEAUDIO
#define MA_ENABLE_ALSA
#endif
+// The null backend: a silent device that still clocks the audio thread. Only opened on
+// purpose, when no real output opens (MiniaudioBackend::start), so Nota still runs.
+#define MA_ENABLE_NULL
#include <miniaudio.h>
diff --git a/src/native/nota.engine/src/engine/Engine.h b/src/native/nota.engine/src/engine/Engine.h
index 61a7ce78..232d4953 100644
--- a/src/native/nota.engine/src/engine/Engine.h
+++ b/src/native/nota.engine/src/engine/Engine.h
@@ -73,6 +73,7 @@ class Engine {
// device refused it and the backend fell back to shared mode. Always false
// on platforms without exclusive mode. Read after applyAudioConfig() / start().
bool audioExclusiveFallback() const { return backend_ ? backend_->exclusiveFallback() : false; }
+ bool audioSilentFallback() const { return backend_ ? backend_->silentFallback() : false; }
int32_t bufferFrames() const { return backend_ ? backend_->bufferFrames() : 0; }
// --- MIDI device settings (M7-2) ---
diff --git a/tests/Nota.SmokeTest/LinuxDesktopTests.cs b/tests/Nota.SmokeTest/LinuxDesktopTests.cs
new file mode 100644
index 00000000..47b1c0ca
--- /dev/null
+++ b/tests/Nota.SmokeTest/LinuxDesktopTests.cs
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Linux desktop robustness: file drops that arrive as text / URI lists (#300), when a
+// system file dialog counts as broken (#297), and an engine that starts without a working
+// audio output (#243). Also runnable alone: `dotnet run --project tests/Nota.SmokeTest -- --linux-desktop`.
+
+using Nota.Application;
+using Nota.Application.Input;
+using Nota.Infrastructure;
+using V = Nota.Application.FileDialogFallback.Verdict;
+
+namespace Nota.SmokeTest;
+
+internal static class LinuxDesktopTests
+{
+ public static IEnumerable<(bool ok, string label)> Run()
+ {
+ // Dropped paths.
+ var uri = DroppedFilePaths.Parse("file:///home/a/My%20Kick.wav\r\nfile:///home/a/b.flac\r\n");
+ yield return (uri.SequenceEqual(new[] { "/home/a/My Kick.wav", "/home/a/b.flac" }), "drop: a uri-list gives decoded local paths");
+ yield return (DroppedFilePaths.Parse("copy\nfile:///x/y.wav").SequenceEqual(new[] { "/x/y.wav" }),
+ "drop: gnome-copied-files skips its copy header");
+ yield return (DroppedFilePaths.Parse("/x/y.wav\0").SequenceEqual(new[] { "/x/y.wav" }), "drop: a plain path, NUL-terminated, is read");
+ yield return (DroppedFilePaths.Parse("/x/Kick \n").SequenceEqual(new[] { "/x/Kick " }),
+ "drop: a plain path keeps a trailing space in its name");
+ yield return (DroppedFilePaths.Parse("# comment\nhttps://e.com/a.wav\nfile://otherhost/a.wav\nrel/a.wav\nhello").Count == 0,
+ "drop: comments, web URLs, remote hosts, relative paths and text are ignored");
+ yield return (DroppedFilePaths.Parse("file://localhost/x/a.wav\nfile:///x/a.wav").SequenceEqual(new[] { "/x/a.wav" }),
+ "drop: localhost is local, and duplicates collapse");
+ yield return (DroppedFilePaths.Parse("file:///C:/Samples/a.wav").SequenceEqual(new[] { "C:/Samples/a.wav" }),
+ "drop: a Windows drive URI keeps its drive");
+ var utf16 = System.Text.Encoding.Unicode.GetBytes("file:///x/a.wav\nKick");
+ yield return (DroppedFilePaths.Parse(DroppedFilePaths.Decode(utf16)).SequenceEqual(new[] { "/x/a.wav" }),
+ "drop: a UTF-16 text/x-moz-url decodes, its title line ignored");
+ byte[] Bom(byte[] bom, byte[] body) => bom.Concat(body).ToArray();
+ yield return (DroppedFilePaths.Decode(Bom(new byte[] { 0xFF, 0xFE }, System.Text.Encoding.Unicode.GetBytes("file:///x/a.wav"))) == "file:///x/a.wav"
+ && DroppedFilePaths.Decode(Bom(new byte[] { 0xFE, 0xFF }, System.Text.Encoding.BigEndianUnicode.GetBytes("file:///x/a.wav"))) == "file:///x/a.wav"
+ && DroppedFilePaths.Decode(Bom(new byte[] { 0xEF, 0xBB, 0xBF }, System.Text.Encoding.UTF8.GetBytes("file:///x/a.wav"))) == "file:///x/a.wav",
+ "drop: text with a byte-order mark (UTF-16 LE / BE, UTF-8) decodes without it");
+
+ // File dialog fallback: a dialog that took the focus is real.
+ yield return (FileDialogFallback.Decide(finished: true, empty: false, shown: false, windowActive: true) == V.Keep,
+ "dialogs: a picked file is kept");
+ yield return (FileDialogFallback.Decide(true, true, shown: true, windowActive: true) == V.Keep,
+ "dialogs: a cancelled dialog that showed is a cancel, not a failure");
+ yield return (FileDialogFallback.Decide(true, true, shown: false, windowActive: true) == V.Fallback,
+ "dialogs: an empty answer that never showed falls back");
+ yield return (FileDialogFallback.Decide(false, false, shown: false, windowActive: true) == V.Fallback,
+ "dialogs: no dialog within the timeout falls back");
+ yield return (FileDialogFallback.Decide(false, false, shown: true, windowActive: false) == V.Wait,
+ "dialogs: an open dialog is waited for");
+ var limit = TimeSpan.FromSeconds(4);
+ yield return (FileDialogFallback.WhileWaiting(false, TimeSpan.Zero, limit) == V.Wait
+ && FileDialogFallback.WhileWaiting(false, TimeSpan.FromSeconds(2), limit) == V.Wait,
+ "dialogs: while the window is away or only just back, the dialog is still waited for");
+ yield return (FileDialogFallback.WhileWaiting(false, TimeSpan.FromSeconds(4), limit) == V.Fallback,
+ "dialogs: focus back for the timeout with the request still open (an app switch, no dialog) falls back");
+ yield return (FileDialogFallback.WhileWaiting(true, TimeSpan.FromSeconds(9), limit) == V.Keep,
+ "dialogs: a dialog that answered while waiting is kept");
+
+ // The engine starts on Linux whatever the audio setup (a device, or the silent stand-in).
+ if (OperatingSystem.IsLinux())
+ {
+ using var eng = new NotaEngine();
+ bool started;
+ try { eng.Start(); started = eng.IsRunning; } catch (NotaEngineException) { started = false; }
+ yield return (started && eng.SampleRate > 0,
+ $"audio: the engine starts ({(eng.AudioSilentFallback ? "silent stand-in" : "device")}, {eng.SampleRate:0} Hz)");
+ eng.Stop();
+ }
+ }
+}
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index cf893e0b..6e736f2b 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -337,6 +337,15 @@ if (args.Length >= 1 && args[0] == "--template")
Console.WriteLine(failures == 0 ? "TEMPLATE PASSED" : $"TEMPLATE FAILED ({failures})");
return failures == 0 ? 0 : 1;
}
+// Linux desktop robustness alone: `--linux-desktop`. Also part of the full run.
+if (args.Length >= 1 && args[0] == "--linux-desktop")
+{
+ Console.WriteLine("-- linux desktop --");
+ foreach (var (ok, label) in LinuxDesktopTests.Run()) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "LINUX DESKTOP PASSED" : $"LINUX DESKTOP FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
+
// Deleting a return track alone: `--returns`. Also part of the full run.
if (args.Length >= 1 && args[0] == "--returns")
{
@@ -15068,6 +15077,9 @@ foreach (var (ok, label) in ProjectTemplateTests.Run()) Check(ok, label);
Console.WriteLine("-- return delete --");
foreach (var (ok, label) in ReturnDeleteTests.Run()) Check(ok, label);
+Console.WriteLine("-- linux desktop --");
+foreach (var (ok, label) in LinuxDesktopTests.Run()) Check(ok, label);
+
Console.WriteLine("-- range clipboard --");
foreach (var (ok, label) in RangeClipboardTests.Run()) Check(ok, label);