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