Transparent Windows on Linux (Electron)

后端 未结 3 2044
长情又很酷
长情又很酷 2021-02-14 23:07

Using the transparent argument and setting it to true when creating a new BrowserWindow in Electron usually gives the window a transparent background... But on Linux that isn\'t

3条回答
  •  再見小時候
    2021-02-14 23:14

    There do seem to be multiple issues with transparency, on different distributions with differing hardware. There are various suggested workarounds. You might not be able to make transparency work acceptably for your scenario on all hardware and distributions.

    Examples

    • https://github.com/electron/electron/issues/2170
    • https://github.com/zeit/hyper/pull/842
    • https://github.com/electron/electron/issues/15947
    • Can't succeed in making transparent window in Electron (javascript)

    From the Electron docs:

    On Linux, users have to put --enable-transparent-visuals --disable-gpu in the command line to disable GPU and allow ARGB to make transparent window, this is caused by an upstream bug that alpha channel doesn't work on some NVidia drivers on Linux.

    https://github.com/electron/electron/blob/master/docs/api/frameless-window.md

提交回复
热议问题