How to Make Transparent Window on Linux

How to make transparent window on linux

This is definitely something that you will want to offload to the GPU. I would not recommend directly using the X11 lib for performance reasons. Let OpenGL do it. I did find the following link for glXChooseVisual.

Also, here is another S.O. question that may be helpful.

Furthermore, this is for windows, but it should still apply.

Transparent Windows on Linux (Electron)

I have encounter the same problem as you and so I have written :

  • this StackOverFlow question :
    Can't succeed in making transparent window in Electron (javascript)
  • this Electron issue : https://github.com/electron/electron/issues/15947
  • and finally request this feature : https://github.com/electron/electron/issues/16809

Till the requested feature is implemented, the solution is simple just add a delay before launching the window.

You can clone this git repo, put the delay to 500, and normally magic will appear.

EDIT 1 :
Use this repo : https://gitlab.com/doom-fr/electron-transparency-demo

git clone https://gitlab.com/doom-fr/electron-transparency-demo
cd electron-transparency-demo
npm install
npm start
# or npm run startWithTransparentOption
# or npm run startWithAllOptions

For me, it works out of the box with Debian Jessie and electron 4.0.5, for npm start, npm run startWithTransparentOption but not with npm run startWithAllOptions.

NB : be carefull to set at least 500ms to have chance it works. After you can reduce the delay but it is not stable. It is why an event on transparentReady is needed.

Doom

Simple way to make a transparent window in Vala & Gtk3?

You should not do this. Gtk+ is just not designed that way. You will have problems with different output backends. Your users will have problems with their user experience.

If you really want to, you have to translate one of the code examples in C, Python, etc. that you can find on the internet.

Here are two such examples:

How to make Gtk+ window background transparent?

http://www.kcjengr.com/programing/2017/11/02/transparent-gtk-window.html

It shouldn't be too hard to translate those into Vala. If you encounter problems, ask new questions about the concrete problems.

Transparent windows with Linux

You can take a look at the code of the X terminal emulators, KTerm for KDE or Gnome Terminal for gnome (depending of your target platform). I think these are the best examples of apps that implement transparency. I think that you can even find in that code solutions for getting transparency when compiz is not available.



Related Topics



Leave a reply



Submit