diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 1a7df62eff5..d8f70479ecb 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Fix GTK4 Linux host dropping custom-protocol and file-association launch arguments in [PR](https://github.com/wailsapp/wails/pull/6000) by @midagedev - Correctly handle deleted lines and same-source corrections in changelog validation in [PR](https://github.com/wailsapp/wails/pull/5993) by @taliesin-ai ## Deprecated diff --git a/v3/pkg/application/application_linux.go b/v3/pkg/application/application_linux.go index db707e9e834..6ecd09c03f4 100644 --- a/v3/pkg/application/application_linux.go +++ b/v3/pkg/application/application_linux.go @@ -18,6 +18,7 @@ import ( "os" "path/filepath" "regexp" + "slices" "strings" "sync" @@ -87,6 +88,28 @@ func (a *linuxApp) name() string { } func (a *linuxApp) run() error { + if len(os.Args) == 2 { + arg1 := os.Args[1] + if strings.Contains(arg1, "://") { + eventContext := newApplicationEventContext() + eventContext.setURL(arg1) + applicationEvents <- &ApplicationEvent{ + Id: uint(events.Common.ApplicationLaunchedWithUrl), + ctx: eventContext, + } + } else if a.parent.options.FileAssociations != nil { + ext := filepath.Ext(arg1) + if slices.Contains(a.parent.options.FileAssociations, ext) { + eventContext := newApplicationEventContext() + eventContext.setOpenedWithFile(arg1) + applicationEvents <- &ApplicationEvent{ + Id: uint(events.Common.ApplicationOpenedWithFile), + ctx: eventContext, + } + } + } + } + a.parent.Event.OnApplicationEvent(events.Linux.ApplicationStartup, func(evt *ApplicationEvent) { if err := a.processAndCacheScreens(); err != nil { a.parent.handleError(err)