Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 7 #12

Open
afriedma opened this issue Feb 3, 2017 · 4 comments
Open

Windows 7 #12

afriedma opened this issue Feb 3, 2017 · 4 comments

Comments

@afriedma
Copy link

afriedma commented Feb 3, 2017

Hi,

I cannot get the notification to show up on windows 7. Can someone please advise?

Thank you

@kevinkir
Copy link

On Windows 7, if you are using a non-aero theme (ex Windows 7 Basic), transparency does not work. The notifications use transparency to round the corners, so you can't have rounded corners on Windows 7 if aero is turned off. If you don't care about that, then the easiest solution is to set defaultWindow.transparent to false, defaultWindow.backgroundColor to the same as defaultStyleContainer.backgroundColor, and defaultWindow.borderRadius to 0.

If you want to keep the rounded corners, you can have logic to check the value of "Composition" in the registry key \HKCU\Software\Microsoft\Windows\DWM. If it's 0x1, then you can do the transparency. Otherwise, you should show the square corners and not do transparency.

@mz3io
Copy link

mz3io commented May 7, 2017

@kevinkir I just tried the above on Windows 7 (set defaultWindow.transparent to false, etc.) and I can get a notification window to display but none of the appIcon, title, or text are displaying. Any suggestions? Thanks!

@dooyou21
Copy link

dooyou21 commented May 17, 2017

@mz3io I had a Same problem. I think the reason is path of 'preload.js' in defaultWindow.
Real config of defaultWindow is below.

  defaultWindow: {
    alwaysOnTop: true,
    skipTaskbar: true,
    resizable: false,
    show: false,
    frame: false,
    transparent: true,
    acceptFirstMouse: true,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      allowDisplayingInsecureContent: true
    }
  },

If I use

defaultWindow: {
      alwaysOnTop: true,
      skipTaskbar: true,
      resizable: false,
      show: false,
      frame: false,
      transparent: true,
      acceptFirstMouse: true
    }

in eNotify.setConfig(),

webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      allowDisplayingInsecureContent: true
    }

are gone. 'path' in this source is electron-notify's path, so I can't just write this code in my config.
I think we need a function to change transparent value of defaultWindow because config = _.defaults(customConfig, config) can't handle this problem.

@kevinkir
Copy link

kevinkir commented May 17, 2017

@dooyou21, my hacky workaround to this was to just to route the path through node_modules:

defaultWindow: {
    alwaysOnTop: true,
    skipTaskbar: true,
    resizable: false,
    show: false,
    frame: false,
    transparent: isTransparencySupported,
    borderRadius: isTransparencySupported ? 5 : 0,
    acceptFirstMouse: true,
    backgroundColor: isTransparencySupported ? undefined : '#ffffff',
    webPreferences: {
        preload: path.join(__dirname, '..', 'node_modules', 'electron-notify', 'preload.js'),
        allowDisplayingInsecureContent: true
    }
}

Notes:

  • The path to the preload script might be different, depending on your project setup. It might not be what you would expect it to be, either. Easiest way to figure it out is to console.log(__dirname), then figure out the path to node_modules based on that.
  • isTransparencySupported is determined based on the value of the "Composition" item in \HKCU\Software\Microsoft\Windows\DWM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants