You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
func (a *App) OnSecondInstanceLaunch(secondInstanceData options.SecondInstanceData) {
if runtime.WindowIsMinimised(a.ctx) {
runtime.WindowUnminimise(a.ctx)
}
runtime.Show(a.ctx)
go runtime.EventsEmit(a.ctx, "launchArgs", secondInstanceData.Args)
}
// 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
}
// 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)
}
Expected behaviour
The window should be restored to maximized when awakened by the singleton.
func (fm *Form) Restore() {
// SC_RESTORE param for WM_SYSCOMMAND to restore app if it is minimized
const SC_RESTORE = 0xF120
// restore the minimized window, if it is
w32.SendMessage(
fm.hwnd,
w32.WM_SYSCOMMAND,
SC_RESTORE, // <- the window has already been restored here.
0,
)
//w32.ShowWindow(fm.hwnd, w32.SW_RESTORE)
w32.ShowWindow(fm.hwnd, w32.SW_SHOW) // <- use this
}
System Details
Wails Doctor
# Wails
Version | v2.9.2
# System
┌─────────────────────────────────────────────────────────────────────────────────────────┐
| OS | Windows 10 Enterprise || Version | 2009 (Build: 22631) || ID | 23H2 || Go Version | go1.22.9 || Platform | windows || Architecture | amd64 || CPU | 13th Gen Intel(R) Core(TM) i9-13900H || GPU 1 | NVIDIA GeForce RTX 3050 4GB Laptop GPU (NVIDIA) - Driver: 31.0.15.2799 || GPU 2 | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 31.0.101.4575 || Memory | 32GB |
└─────────────────────────────────────────────────────────────────────────────────────────┘
# 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
No response
The text was updated successfully, but these errors were encountered:
Are you saying w32.ShowWindow(fm.hwnd, w32.SW_SHOW) // <- use this fixes this? If so, please raise a PR 👍
Below is Microsoft's official description of the second parameter of ShowWindow. It states that SW_RESTORE restores the window to its original size and position when it is minimized, maximized, or arranged, which is the cause of this issue.
Value
Meaning
SW_SHOW (5)
Activates the window and displays it in its current size and position.
SW_RESTORE (9)
Activates and displays the window. If the window is minimized, maximized, or arranged, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
Description
After maximizing the window and minimizing it, waking it up through the singleton does not restore maximization. @leaanthony
To Reproduce
Create a single-instance maximized window.
Expected behaviour
The window should be restored to maximized when awakened by the singleton.
Screenshots
20250303-190322.mp4
Attempted Fixes
https://github.com/wailsapp/wails/blob/master/v2/internal/frontend/desktop/windows/winc/form.go:138
System Details
Additional context
No response
The text was updated successfully, but these errors were encountered: