code: func newWindow(o Options, p Paths, url string, wo *WindowOptions, c *asticontext.Canceller, d *dispatcher, i *identifier, wrt *writer) (w *Window, err error) {
  	// Init
  	w = &Window{
  		callbackIdentifier: newIdentifier(),
  		o:                  wo,
  		object:             newObject(nil, c, d, i, wrt, i.new()),
  	}
  	w.Session = newSession(w.ctx, c, d, i, wrt)
  
  	// Check app details
  	if wo.Icon == nil && p.AppIconDefaultSrc() != "" {
  		wo.Icon = PtrStr(p.AppIconDefaultSrc())
  	}
  	if wo.Title == nil && o.AppName != "" {
  		wo.Title = PtrStr(o.AppName)
  	}
  
  	// Make sure the window's context is cancelled once the closed event is received
  	w.On(EventNameWindowEventClosed, func(e Event) (deleteListener bool) {
  		w.cancel()
  		return true
  	})
  
  	// Show
  	w.On(EventNameWindowEventHide, func(e Event) (deleteListener bool) {
  		w.m.Lock()
  		defer w.m.Unlock()
  		w.o.Show = PtrBool(false)
  		return
  	})
  	w.On(EventNameWindowEventShow, func(e Event) (deleteListener bool) {
  		w.m.Lock()
  		defer w.m.Unlock()
  		w.o.Show = PtrBool(true)
  		return
  	})
  
  	// Parse url
  	if w.url, err = astiurl.Parse(url); err != nil {
  		err = errors.Wrapf(err, "parsing url %s failed", url)
  		return
  	}
  	return
  }
docs: // newWindow creates a new window