electron控制台打开切换,默认全屏


-

// 控制台切换
    window.addEventListener('keydown', (e) => {
      const { altKey, ctrlKey, keyCode } = e;
      console.log(keyCode, 'keyCode');
      //  alt + ctrl + (Command | Windows) + l
      if (keyCode === 123) {
        //获取当前窗体
        const currentWindow = window.require('electron').remote.getCurrentWindow();
        currentWindow && currentWindow.toggleDevTools();
        e.preventDefault();
      }
    }, false);

 默认全屏

app.whenReady().then(() => {
  // We cannot require the screen module until the app is ready.
  const { screen } = require('electron')

  // Create a window that fills the screen's available work area.
  const primaryDisplay = screen.getPrimaryDisplay()
  const { width, height } = primaryDisplay.workAreaSize

  mainWindow = new BrowserWindow({ width, height })
  mainWindow.loadURL('https://electronjs.org')
})

 

 

-


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM