Skip to content
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 added for pde:// browser protocol #689

Closed
wants to merge 0 commits into from
Closed

Conversation

peonix0
Copy link

@peonix0 peonix0 commented Mar 18, 2023

I have added the support of pde:// browser protocol for linux(Fixes: #674 )
which enables the opening of *.pde file from web URLs using the pde:// protocol.

@benfry Could you please review and merge this pull request.
Thanks!

@SableRaf SableRaf added the Linux Issue is specific to Linux label Mar 23, 2023
Icon=<ICON_NAME>
Terminal=false
Categories=Development;IDE;Programming;
MimeType=text/x-processing;
MimeType=text/x-processing;x-scheme-handler/pde;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pde-handler.sh script is not necessary, it looks like it is just unquoting the URL and passing it to the processing binary. Why not let processing handle the URLs itself? I don't think the unquoting is desirable in our case. These lines (1/2) should be all we need to get the pde:// scheme working, I would take out the script.

This answer that Ben linked: https://unix.stackexchange.com/questions/497146/create-a-custom-url-protocol-handler/497147#497147 is about a slightly different use case.

Copy link
Author

@peonix0 peonix0 Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried working with that?? and I don't think processing executable can handle url encoded path

I tried xdg-open pde://home/deidara/sketchbook/SimpleExport/SimpleExport.pde
but not working the way you said.

Correct me if I'm wrong, I have tried your way but not working for me.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me, try with an extra / after the pde://: xdg-open pde:///home/deidara/sketchbook/SimpleExport/SimpleExport.pde. Oh, and it may need to be a .pdez or .pdex archive rather than a .pde. From reading the release notes it doesn't look like .pde files are supported: https://github.com/processing/processing4/releases/tag/processing-1292-4.2

The release notes mention a URL with 3 slashes, similar to file:///:

Linking to pde://processing.org/somesketch.pdez in the browser will download somesketch.pdez and load it into the editor. It also works for files, for instance pde:///Users/ada/Desktop/somesketch.pdez will open an archive found on the Desktop.

This test page also works for me, see if it works for you: https://sableraf.github.io/testURIscheme/

Note: if Processing is not yet open and I run xdg-open pde://sableraf.github.io/testURIscheme/sketchBundle.pdez, it doesn't work and I see the following error in my terminal:

java.io.IOException: No such file or directory
	at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.base/java.io.File.createTempFile(File.java:2170)
	at processing.app.Base.openSketchBundle(Base.java:1217)
	at processing.app.Base.handleOpen(Base.java:1412)
	at processing.app.Base.<init>(Base.java:543)
	at processing.app.Base.createAndShowGUI(Base.java:286)
	at processing.app.Base.lambda$main$0(Base.java:130)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

If Processing is already open, it works fine. But I also see this error if I open a sketch from the command line, like processing /path/to/sketch.pde, so I don't think it is related to the pde:// scheme handling.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh!, got yout point and my mistakes o7
I'll required make changes, thankss!

@@ -64,10 +68,16 @@ xdg_install_f() {
# Make the Processing Development Environment the default app for *.pde files
xdg-mime default ${RESOURCE_NAME}.desktop text/x-processing

# Make the Processing Development Environment the default app for pde scheme
xdg-mime default ${RESOURCE_NAME}.desktop x-scheme-handler/pde

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2/2)

@peonix0 peonix0 closed this Apr 6, 2023
@peonix0 peonix0 deleted the dev1 branch April 6, 2023 15:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Linux Issue is specific to Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register pde:// browser protocol for .pdez and .pdex files on Linux
3 participants