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')
})
复制代码

 

 

-

posted @   古墩古墩  Views(1549)  Comments(0Edit  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
历史上的今天:
2021-02-27 element-ui中el-date-picker时间选择器限制选择7天内数据、获取某一天0点或23:59:59
2020-02-27 小结一下,登录如何判断不同标签页登录两个账号的问题
2020-02-27 edge浏览器两个标签页localStorage不同步,解决办法
2020-02-27 关闭浏览器窗口的兼容性写法
点击右上角即可分享
微信分享提示