-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .db or .csv/.tsv files being dragged and dropped onto the app (or app icon) #40
Comments
I tried adding this: app.on("open-file", (event, path) => {
console.log("open-file:", event, path)
});
// Directly before this line:
app.whenReady().then(() => { But the icon in the Dock (at least when running in |
This might turn out to be part of the work on #54. |
Maybe this will start working if I add the 'open-file' event handler and run a proper build of the application? No, tried that and it didn't make the icon a drop target. |
On Windows it sounds like dragging a file to the icon will work differently - it will call the application itself and pass that file path as I only care about macOS for the moment though. |
This might be the answer! electron/electron#4403 (comment)
|
From electron-userland/electron-builder#3732 (comment) it looks like you can add things to GitHub code search has some examples: https://github.com/search?l=JSON&q=extendInfo+CFBundleDocumentTypes&type=Code These examples look useful:
|
This worked: diff --git a/package.json b/package.json
index 9aa3db1..7ee237e 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,16 @@
"appId": "io.datasette.app",
"mac": {
"category": "public.app-category.developer-tools",
+ "extendInfo": {
+ "CFBundleDocumentTypes": [
+ {
+ "CFBundleTypeExtensions": [
+ "csv", "tsv", "db"
+ ],
+ "LSHandlerRank": "Alternate"
+ }
+ ]
+ },
"hardenedRuntime" : true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist", |
From #88 (comment)
|
After that last commit (and doing a proper application install) (But only if Datasette is already open, I still need to fix it so the Also |
Tangential to this issue but relevant to Windows (#71), Application Registration needs to be done on Windows in order for Datasette to be a viable Filed away for later when you look into Windows I guess. |
Need to build and install to test this.
Tested with this build https://github.com/simonw/datasette-app/actions/runs/1225528995 and while double-clicking a .db file or "Open in Datasette"-ing a CSV file did cause the Datasette application to open, the files were NOT attached once it had started up. With Datasette open double-clicking or using "Open in Datasette" did work. |
The build from https://github.com/simonw/datasette-app/actions/runs/1225558655 works! |
Would be useful as a shortcut for opening files.
https://www.electronjs.org/docs/api/app#event-open-file-macos suggests this may be possible through listening to the
open-file
event:The text was updated successfully, but these errors were encountered: