Open audio files with Atmosphere, and drop files onto the window

- Audio files can be opened with Atmosphere (file associations in the installer)
- Opening a file while Atmosphere runs hands it to the open window instead of a second copy
- Files outside your library play without being added; library files play as themselves
- Dropping audio files on the window copies them into an Imported folder and plays them
- macOS "Open with" works through the app's open-file event
This commit is contained in:
Christian
2026-11-19 01:04:24 -05:00
parent 2fafd29c81
commit bfaa53ddc3
9 changed files with 203 additions and 5 deletions
+10 -1
View File
@@ -241,6 +241,7 @@ async function init() {
bindPlaybackSettings();
bindSearch();
bindTools();
bindOpenFiles();
bindStats();
await listen("atmosphere://job", (e) => onJob(e.payload));
await listen("atmosphere://probe", (e) => onProbe(e.payload));
@@ -406,9 +407,17 @@ function bindShell() {
const t = e.target;
if (t.nodeType !== 1 || (t.getAttribute("draggable") !== "true" && !t.closest?.('[draggable="true"]'))) e.preventDefault();
});
document.addEventListener("dragover", (e) => e.preventDefault());
document.addEventListener("dragover", (e) => {
e.preventDefault();
if (e.dataTransfer.types.includes("Files")) showDropHint();
});
document.addEventListener("dragleave", (e) => {
if (!e.relatedTarget) hideDropHint();
});
document.addEventListener("drop", (e) => {
e.preventDefault();
hideDropHint();
if (e.dataTransfer.files?.length) return importDropped([...e.dataTransfer.files]);
const text = (e.dataTransfer.getData("text/uri-list") || e.dataTransfer.getData("text/plain") || "").trim();
if (/^https?:\/\//i.test(text)) {
go("get");