Skip to content

[v2.10.1] Cannot quit when clicking and holding down on the window header #4264

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

Open
educator-art opened this issue May 3, 2025 · 3 comments
Labels
Bug Something isn't working

Comments

@educator-art
Copy link

Description

cannot quit when clicking and holding down on the window header

To Reproduce

  1. create project
wails init -n myproject -t vanilla
  1. edit app.go
package main

import (
	"context"
	"fmt"
	"time"

	// https://pkg.go.dev/github.com/wailsapp/wails/[email protected]/pkg/runtime#Quit
	runtime "github.com/wailsapp/wails/v2/pkg/runtime"
)

// App struct
type App struct {
	ctx context.Context
}

// NewApp creates a new App application struct
func NewApp() *App {
	return &App{}
}

// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
	a.ctx = ctx
	time.Sleep(10 * time.Second)
	// https://pkg.go.dev/github.com/wailsapp/wails/[email protected]/pkg/runtime#Quit
	// Cannot quit when clicking and holding down on the window header. (windows11) (wails v2.10.1)
	runtime.Quit(a.ctx)
}

// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
	return fmt.Sprintf("Hello %s, It's show time!", name)
}
  1. run
wails dev 

Expected behaviour

app quit

Screenshots

Image

Attempted Fixes

I Tried

System Details

Wails Doctor



# Wails
Version | v2.10.1


# System
┌────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                          |
| Version      | 2009 (Build: 26100)                                     |
| ID           | 24H2                                                    |
| Go Version   | go1.24.2                                                |
| Platform     | windows                                                 |
| Architecture | amd64                                                   |
| CPU          | AMD Ryzen 5 4500 6-Core Processor                       |
| GPU          | NVIDIA GeForce GTX 1630 (NVIDIA) - Driver: 32.0.15.7283 |
| Memory       | 32GB                                                    |
└────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 135.0.3179.98 |
| Nodejs     | N/A          | Installed | 20.9.0        |
| npm        | N/A          | Installed | 10.1.0        |
| *upx       | N/A          | Available |               |
| *nsis      | N/A          | Available |               |
|                                                       |
└─────────────── * - Optional Dependency ───────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Additional context

※Updated to Windows 11

I would appreciate it if you could help me with this

*Please note that this text is machine-translated.

@educator-art educator-art added the Bug Something isn't working label May 3, 2025
@leaanthony
Copy link
Member

Do you mean when you are holding and moving the window titlebar?

@educator-art
Copy link
Author

educator-art commented May 5, 2025

Thank you for your comment.
Yes, the application doesn't quit while the window title bar is being held, and it also doesn't quit after releasing it.
"Moving" occurred when I tried to stop the recording. Sorry for the confusion.

*Please note that this text is machine-translated.

@educator-art
Copy link
Author

educator-art commented May 16, 2025

By displaying a dialog box before closing the application, the cursor was moved away from the title bar.
It's not the best solution, but it resolves the problem.

package main

import (
	"context"
	"fmt"
	"time"

	// https://pkg.go.dev/github.com/wailsapp/wails/[email protected]/pkg/runtime#Quit
	runtime "github.com/wailsapp/wails/v2/pkg/runtime"
)

// App struct
type App struct {
	ctx context.Context
}

// NewApp creates a new App application struct
func NewApp() *App {
	return &App{}
}

// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
	a.ctx = ctx
	time.Sleep(10 * time.Second)
	// https://pkg.go.dev/github.com/wailsapp/wails/[email protected]/pkg/runtime#Quit

	// Cannot quit when clicking and holding down on the window header. (windows11) (wails v2.10.1)

	// 2025.05.17
	// (Alternative Plan)
	// Add a dialog box before the app exits.
	//  When the dialog box is displayed, the cursor moves away from the title bar
	ShowMessageDialog(a.ctx)
	// The application has closed.
	runtime.Quit(a.ctx)
}

// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
	return fmt.Sprintf("Hello %s, It's show time!", name)
}

func ShowMessageDialog(ctx context.Context) {

	runtime.MessageDialog(ctx, runtime.MessageDialogOptions{
		Type:          "info",
		Title:         "information",
		Message:       "The app will quit after the OK button is clicked.",
		Buttons:       []string{"OK"}, 
		DefaultButton: "OK",
	})

}

*Please note that this text is machine-translated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants