Skip to content

[v3] SaveFileDialog.SetFilename() has no effect on Linux #4841

@samstanier

Description

@samstanier

Description

When using SaveFileDialog.SetFilename() on Linux, the filename is not pre-populated in the GTK file chooser dialog. The same code works correctly on Windows and macOS.

To Reproduce

  1. Create a save file dialog with a default filename:
result, err := application.SaveFileDialog().
    SetFilename("example.txt").
    PromptForSingleSelection()
2. Run on Linux
3. Observe that the filename field in the dialog is empty


### Expected behaviour

The filename field should be pre-populated with "example.txt".


### Screenshots

_No response_

### Attempted Fixes

Extra arguments can be passed to runChooserDialog to correct this behaviour.


### System Details

```shell
Wails (v3.0.0-dev)  Wails Doctor 
                                                                                                                                                                                
# System 

┌────────────────────────────────────────────────────────────────────────────────────────┐
| Name         | Arch Linux                                                              |
| Version      | Unknown                                                                 |
| ID           | arch                                                                    |
| Branding     |                                                                         |
| Platform     | linux                                                                   |
| Architecture | amd64                                                                   |
| CPU          | Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz                               |
| GPU 1        | GP107GLM [Quadro P2000 Mobile] (NVIDIA Corporation) - Driver: nouveau   |
| GPU 2        | CoffeeLake-H GT2 [UHD Graphics 630] (Intel Corporation) - Driver: i915  |
| Memory       | 31GB                                                                    |
└────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment 

┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-dev                                                                         |
| Go Version     | go1.25.3 X:nodwarf5                                                                |
| Revision       | be60783f3a7f81366f4a60348c530dbf5d8d40b2                                           |
| Modified       | false                                                                              |
| -buildmode     | exe                                                                                |
| -compiler      | gc                                                                                 |
| CGO_CFLAGS     |                                                                                    |
| CGO_CPPFLAGS   |                                                                                    |
| CGO_CXXFLAGS   |                                                                                    |
| CGO_ENABLED    | 1                                                                                  |
| CGO_LDFLAGS    |                                                                                    |
| DefaultGODEBUG | containermaxprocs=0,decoratemappings=0,tlssha1=1,updatemaxprocs=0,x509sha256skid=0 |
| GOAMD64        | v1                                                                                 |
| GOARCH         | amd64                                                                              |
| GOEXPERIMENT   | nodwarf5                                                                           |
| GOOS           | linux                                                                              |
| vcs            | git                                                                                |
| vcs.modified   | false                                                                              |
| vcs.revision   | be60783f3a7f81366f4a60348c530dbf5d8d40b2                                           |
| vcs.time       | 2025-09-08T08:42:14Z                                                               |
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies 

┌──────────────────────────────────────────┐
| gcc        | 15.2.1+r301+gf24307422d1d-1 |
| gtk3       | 1:3.24.51-1                 |
| npm        | 11.6.4                      |
| pkg-config | 2.5.1-1                     |
| webkit2gtk | 2.50.4-1                    |
|                                          |
└──────── * - Optional Dependency ─────────┘

# Checking for issues 

SUCCESS  No issues found

# Diagnosis 

SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

In v3/pkg/application/linux_cgo.go and linux_purego.go, the runChooserDialog function never receives or uses the filename parameter. The runSaveFileDialog function has access to dialog.filename but doesn't pass it to runChooserDialog, and gtk_file_chooser_set_current_name() is never called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions