-
Notifications
You must be signed in to change notification settings - Fork 74
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
Linux Support #20
Comments
@edeuss I recently published Desktop Entry that might be helpful. It includes an example project that uses Deep Links. It uses the Desktop Entry Specification in conjunction with DBus to launch an app from a custom scheme URI or open it in an existing instance of the app if one is already open. I think the primary reason this problem has not been handled by various packages is that the operations to register a custom scheme would be best performed by an installer / distributor. E.g. Flatpak, Steam etc. One notable issue is that how other applications handle your custom URI is not within your control. E.g. Firefox might treat your URI as a Google Search query. You can use Desktop Entry to tell the OS that your app handles the scheme, but other apps (e.g. web browsers) may not necessarily honour that. |
@markvideon do you have an idea how one could handle it for a snap? |
I have implemented the deep linking feature on Linux. Initially, I followed the suggestion from @markvideon and implemented it on Linux. However, it's too complicated for the setup step. Later, my colleague hinted to me that there's a package named showcase.mp4It just needs a few steps to set up:
|
@LucasXu0 wow! Really appreciate your work! If using your second approach, does it also work in Snap and Flatpak? |
@CaptainDario Yes. The running application in the video was built by flatpak. I didn't verify it on snap, but I suppose that it should work too. |
Wow, then this is really awesome! Hopefully, it gets included in this package. |
Would you mind trying it with commit? Because I've made several modifications to my forked repo, and cleaning up the test code will require some time. Override these deps in the pubspec.yaml.
Furthermore, please refer to this PR. |
Sure would love to give it a try! So I have to
And I should be good to go, right? Or am I missing something? |
@CaptainDario Yes, That's all. You don't need to import the gtk package. Does it work? One more thing, please note that your application ID (APPLICATION_ID) should match the ID in your snap/flathub yaml file. |
@LucasXu0 Hi, I tested it on friday and once registered via The only change I had to make is regarding the GTK setup, placing the static void my_application_activate(GApplication *application) {
MyApplication *self = MY_APPLICATION(application);
GList *windows = gtk_application_get_windows(GTK_APPLICATION(application));
if (windows) {
gtk_window_present(GTK_WINDOW(windows->data));
return;
}
GtkWindow *window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); I'm not familiar with GTK, but it makes sense to me since querying the window after creating one would find it and immediately return without finishing the setup. |
Hi, @cocorax. Yes. You don't need to set up the other steps if you just intend to open your app via the scheme without processing the content received from the scheme. |
@LucasXu0 yes, works great! I tried it as a snap and everything is registered perfectly. My .desktop file
However, I also encountered the empty widow mentioned by @cocorax . Didn't try his work around yet. |
@CaptainDario How did you change the static void my_application_activate(GApplication *application)
{
MyApplication *self = MY_APPLICATION(application);
GList* windows = gtk_application_get_windows(GTK_APPLICATION(application));
if (windows) {
gtk_window_present(GTK_WINDOW(windows->data));
return;
} |
mine looks like this // Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// app links support - start
GList* windows = gtk_application_get_windows(GTK_APPLICATION(application));
if (windows) {
gtk_window_present(GTK_WINDOW(windows->data));
return;
}
// app links support - end I am gonna try @cocorax 's work around |
Seems to be working like this // Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
// app links support - start
GList* windows = gtk_application_get_windows(GTK_APPLICATION(application));
if (windows) {
gtk_window_present(GTK_WINDOW(windows->data));
return;
}
// app links support - end
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); Did not try as a snap yet but will do so later today |
@LucasXu0 any plans on opening an PR for this? |
@LucasXu0 how would one go about supporting universal links like on iOS? Something like https://my.cool.app/app/ . Is this possible? |
@CaptainDario I have submitted the PR. #76
It seems NO. Your URL format may only work on iOS or macOS. |
@LucasXu0 thank you for the info and also the PR! |
Linux support is available in app_links 3.5.0-beta.1. Please have a look to the README file. |
Can someone confirm it's working fine? I've received an new issue about linux #84 but I don't have Linux OS to reproduce. |
I updated our project to |
Released v3.5.0. |
Hi and can you give me code in main.dart file. Thanks |
Would be great to have Linux support!
The text was updated successfully, but these errors were encountered: