MCPcopy Create free account
hub / github.com/deta/surf / createOverlayView

Method createOverlayView

app/src/main/viewManager.ts:588–645  ·  view source on GitHub ↗
(opts: WebContentsViewCreateOptions, extraOpts?: any)

Source from the content-addressed store, hash-verified

586 }
587
588 createOverlayView(opts: WebContentsViewCreateOptions, extraOpts?: any) {
589 const additionalArgs = [
590 `--userDataPath=${app.getPath('userData')}`,
591 `--appPath=${app.getAppPath()}${isDev ? '' : '.unpacked'}`,
592 `--overlayId=${opts.overlayId || 'default'}`,
593 ...(process.env.ENABLE_DEBUG_PROXY ? ['--enable-debug-proxy'] : []),
594 ...(process.env.DISABLE_TAB_SWITCHING_SHORTCUTS ? ['--disable-tab-switching-shortcuts'] : [])
595 ]
596
597 log.log('createOverlayView with opts', opts, 'and args', additionalArgs)
598
599 const view = new WCView(
600 {
601 partition: 'persist:surf-app-session',
602 preload: path.resolve(__dirname, '../preload/overlay.js'),
603 additionalArguments: additionalArgs,
604 sandbox: false,
605 transparent: true,
606 ...opts
607 },
608 this,
609 extraOpts
610 )
611
612 // view.wcv.setBorderRadius(18)
613
614 log.log('[main] webcontentsview-create: registering id', view.id)
615 this.views.set(view.id, view)
616 this.activeOverlayViewId = view.id
617
618 //this.addChildView(view)
619 log.log('[main] webcontentsview-create: added view to window with id', view.id)
620
621 this.emit('create', view)
622
623 // Apply current color scheme to newly created overlay view
624 const config = getUserConfig()
625 const colorScheme = config?.settings?.app_style || 'light'
626 this.applyColorSchemeToView(view, colorScheme)
627
628 if (opts.overlayId) {
629 log.log(
630 '[main] webcontentsview-create: loading overlay for view with id',
631 view.id,
632 'and overlayId',
633 opts.overlayId
634 )
635
636 view.loadOverlay()
637 }
638
639 // view.wcv.webContents.on('blur', () => {
640 // log.log('[main] webcontentsview-blur: view with id', view.id, 'lost focus, hiding it')
641 // this.hideView(view.id)
642 // })
643
644 return view
645 }

Callers 2

attachIPCEventsMethod · 0.95

Calls 4

loadOverlayMethod · 0.95
getUserConfigFunction · 0.90
logMethod · 0.80

Tested by

no test coverage detected