wails
wails copied to clipboard
Allow to get AppID programmatically from go
Is your feature request related to a problem? Please describe.
For many purposes of binding notifications and background processes windows requires the appID to bind.
Describe the solution you'd like
Have the ability to get the AppID when running production through the app handle or something similar.
Describe alternatives you've considered
There would be no alternatives for this. Windows 11 makes it nearly impossible to get the AppID without creating and saving it programmatically.
Additional context
The appID should definitely be available for people want to extend wails basic functionality.
Happy to discuss this and accept a PR 👍
Lovely, thanks sm! I think it'll be as simple as adding a field to the wails conf that's called "I'd"
Also, not exactly sure how nsis works, how would I create a variable in nsis that then the build of the wails project fills in with a value?
There's some metadata in wails.json that might suit your needs 👍
If I'm understanding the problem correctly, I believe you can get this as follows:
package main
import (
"fmt"
"golang.org/x/sys/windows/registry"
)
func main() {
appName := "YourApplicationName"
keyPath := `SOFTWARE\Classes\AppID`
key, err := registry.OpenKey(registry.LOCAL_MACHINE, keyPath, registry.READ)
if err != nil {
fmt.Printf("Failed to open registry key: %v\n", err)
return
}
defer key.Close()
appID, _, err := key.GetStringValue(appName)
if err != nil {
fmt.Printf("Failed to retrieve AppID: %v\n", err)
return
}
fmt.Printf("AppID: %s\n", appID)
}
Closing for now. Please reopen if you can think of a good reason to make it a core functionality.