package main import ( "log" "net/http" "github.com/wailsapp/wails/v3/pkg/application" ) // This example demonstrates how to create a Spotlight-like launcher window // that appears on all macOS Spaces and can overlay fullscreen applications. // // Key features: // - Window appears on all Spaces (virtual desktops) // - Can overlay fullscreen applications // - Floating window level keeps it above other windows // - Accessory activation policy hides from Dock // - Frameless design with translucent backdrop func main() { app := application.New(application.Options{ Name: "Spotlight Example", Description: "A Spotlight-like launcher demonstrating CollectionBehavior", Mac: application.MacOptions{ // Accessory apps don't appear in the Dock ActivationPolicy: application.ActivationPolicyAccessory, ApplicationShouldTerminateAfterLastWindowClosed: true, }, Assets: application.AssetOptions{ Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) w.Write([]byte(spotlightHTML)) }), }, }) // Create a Spotlight-like window app.Window.NewWithOptions(application.WebviewWindowOptions{ Title: "Spotlight", Width: 680, Height: 80, Frameless: true, // Center the window InitialPosition: application.WindowCentered, // Prevent resizing DisableResize: true, Mac: application.MacWindow{ // Combine multiple behaviors using bitwise OR: // - CanJoinAllSpaces: window appears on ALL Spaces (virtual desktops) // - FullScreenAuxiliary: window can overlay fullscreen applications CollectionBehavior: application.MacWindowCollectionBehaviorCanJoinAllSpaces | application.MacWindowCollectionBehaviorFullScreenAuxiliary, // Float above other windows WindowLevel: application.MacWindowLevelFloating, // Translucent vibrancy effect Backdrop: application.MacBackdropTranslucent, // Hidden title bar for clean look TitleBar: application.MacTitleBar{ AppearsTransparent: true, Hide: true, }, }, URL: "/", }) err := app.Run() if err != nil { log.Fatal(err) } } const spotlightHTML = ` Spotlight
`