GregVido / mica-electron

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

Error "Mica-Electron work only on Windows 11." #38

Open gaetandezeiraud opened 2 months ago

gaetandezeiraud commented 2 months ago

I got "Mica-Electron work only on Windows 11." when running on Windows 10. But at the same time, the Github Readme say "Mica electron is now compatible with windows 10". What is true?

I use it like so:

  // Enable mica or acrylic
  if (IS_WINDOWS_11) {
    mainWindow.setMicaEffect();
  } else {
    mainWindow.setAcrylic();
  }

Thanks.

gaetandezeiraud commented 2 months ago

Same as https://github.com/GregVido/mica-electron/issues/31 I am on the version 1.5.9. It is a regression?

GregVido commented 2 months ago

Hi, yes it's true, can I see all of your code to understand where the problem is?

gaetandezeiraud commented 2 months ago

Thank you for the answer. Nothing more, the code I quoted. And the use of MicaBrowserWindow.

import { app } from 'electron';
const { MicaBrowserWindow, IS_WINDOWS_11 } = require('mica-electron');

...

// Create the browser window.
  mainWindow = new MicaBrowserWindow({
    autoHideMenuBar: true,
    minHeight: 500,
    minWidth: 980,
    width: 1070,
    height: 650,
    show: false,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
    },
  });

  // Enable mica or acrylic
  if (IS_WINDOWS_11) {
    mainWindow.setMicaEffect();
  } else {
    mainWindow.setAcrylic();
  }

  // Dark or Light theme
  const currTheme = store.get('theme', 'system');
  if (currTheme == 'dark') {
    mainWindow.setDarkTheme();
  } else if (currTheme == 'light') {
    mainWindow.setLightTheme();
  } else {
    mainWindow.setAutoTheme();
  }
gaetandezeiraud commented 2 months ago

Okay, after more investigation, seems related to setAutoTheme / setDarkTheme / setLightTheme who are only for Windows 11.

gaetandezeiraud commented 2 months ago

Not fixed finally. The error is trigger here https://github.com/GregVido/mica-electron/blob/6c62b86bc6af04126a85b24463598c9fb1ecc095/module/app.cpp#L41