Closed alvinwan closed 1 year ago
My understanding is that other deeplinking utilities like electron-deeplink
handle deeplinking by capturing file open events (index.ts#L85-L86) according to SO.
Then, judging by SO and maybe https://github.com/ronaldoussoren/py2app/issues/490, the above would be achieved by listening for events either (a) using a GUI library handler or (b) by implementing it manually in pyobjc.
In my particular case, I was using pywebview, which I didn't realize could be configured to use qt as an engine. Once that was done, I was able to hack on pywebview to use qtpy's event handler.
While the app is currently running, is it possible to capture deeplink arguments?
Here's a minimal app with deeplink support to reproduce what I mean.
app.py
setup.py
With this setup, I run the usual packaging.
Now I can try the deeplink for "page1".
The app opens, and it remains open. At this point,
/Users/test.txt
contains the deeplink "page1".Still with the application open, I try a new deeplink for "page2". This focuses the existing application.
However, this time, the script isn't rerun as it's already running. If I check
/Users/test.txt
, it will still be "page1":Is there a way to setup the deeplink so that the script is rerun (even if the app is already open), making the file above say "page2"?
dist/app.app/Contents/MacOS/app page1
anddist/app.app/Contents/MacOS/app page2
, so it must be a deeplink-specific issue.