GregVido / mica-electron

Library to add mica effect of windows 11 in electron app
Apache License 2.0
126 stars 7 forks source link

Shows old windows style title bar when maximized #37

Open codeAbinash opened 5 months ago

codeAbinash commented 5 months ago

Shows old windows style title bar when maximized.

Screenshot (111)

But in normal window it works fine.

Screenshot 2024-03-23 134219

mica-electron version 1.5.3


function createWindow(): void {
  const mainWindow = new MicaBrowserWindow({
    width: 1100,
    height: 600,
    show: false,
    titleBarStyle: 'default',
    autoHideMenuBar: true,
    ...(process.platform === 'linux' ? { icon } : {}),
    webPreferences: {
      preload: join(__dirname, '../preload/index.js'),
      sandbox: false
    }
  })

  mainWindow.setDarkTheme()
  mainWindow.setMicaEffect()

  mainWindow.on('ready-to-show', () => {
    mainWindow.show()
  })

  mainWindow.webContents.setWindowOpenHandler((details) => {
    shell.openExternal(details.url)
    return { action: 'deny' }
  })

  // HMR for renderer base on electron-vite cli.
  // Load the remote URL for development or the local html file for production.
  if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
    mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
  } else {
    mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
  }
}

Is there any solution?
gaetandezeiraud commented 5 months ago

Same problem for me.

codeAbinash commented 4 months ago

Any solution?

GregVido commented 4 months ago

Hello, I have been working on the problem for several months, it is quite complicated to solve, I need to understand how the maximize screen is interpreted under Windows (API, C...). This bug only affects Electron v27.0.0 and above.

GregVido commented 4 months ago

I finally found how to fix this, you can update mica-electron (very good timing though) 🥳🥳

tiagorangel2011 commented 1 month ago

It's still using the old titlebar for me. I'm using the latest version, 1.5.15

image

tiagorangel2011 commented 1 month ago

This is the only thing preventing me from using this

mcbutnugget commented 3 weeks ago

it appears to be a bug starting from 1.5.11, when using this version it says "ReferenceError: IS_WINDOWS_11 is not defined", then the following update 1.5.12 goes back to the old windows title bar, downgrading anywhere between and including 1.5.6 to 1.5.10 seems to fix it for me