equalsraf / neovim-qt

Neovim client library and GUI, in Qt5.
https://github.com/equalsraf/neovim-qt/wiki
ISC License
1.85k stars 171 forks source link

[Feature Request] Add Background-Only Transparency to GuiWindowOpacity #815

Open jgehrig opened 3 years ago

jgehrig commented 3 years ago

Additional Request from Issue #411

Some users want the ability to set background-only transparency. Extend GuiWindowOpacity so text can be made opaque.

I'm not sure how this can be accomplished with Qt... Can QGraphicsEffect be used?

FYI @matheusfillipe

thePHTest commented 3 years ago

I would love this feature as a shader artist! Any guidance would be appreciated for how to achieve this. I am currently working on building neovim-qt from source to attempt this.

jgehrig commented 3 years ago

It looks like this can be accomplished with Qt...

Here is a very quick-and-hacky patch: background_only_transparency.txt

image

I'm not sure if the additional complexity is worth it. To me, it looks quite similar to full-window :GuiWindowOpacity.

Maybe someone who want this feature can create a Pull Request with improved code and do the necessary testing on each platforms?

matheusfillipe commented 3 years ago

@jgehrig Oh it is not very similar at all, I think this is the proper way to do background transparency. The text still remains clear to see, if you look on the bottom "[No Name..." the difference is screaming! At least to me that's how transparency should be handled. The other solution you could already do with the compositor of your system anyway. I would appreciate that!

jgehrig commented 3 years ago

Pull Requests welcomed! 😄

I've got enough work on my plate at the moment. This will require some careful testing (time). Hopefully someone who wants this feature can pick up the slack.

If someone doesn't put a PR together, I will try to find some time eventually.

matheusfillipe commented 3 years ago

I recently applied your patch and it's been working fine. image Looks cool with picom blur! image

I don't think I know enough C++ to submit a PR for this though 😅. The only problem I had with this patch was that the entire buffer isn't being updated when I run the :GuiWindowOpacity command, so i have to scroll or :e for it to update:

guiWindowOpacity

I applied the patch on e1fc9d3684cbbdf29716cce212d52022e326b014.

jgehrig commented 3 years ago

@matheusfillipe

I don't think I know enough C++ to submit a PR for this though :sweat_smile:.

The best way to learn is by doing! :smile:

Thanks for the bug reports. Tracking known-issues here is helpful for when someone starts the work.

If no one picks this up... I'll try to get to it eventually.

zeertzjq commented 3 years ago

Making all background colors transparent can make a statusline with powerline symols look weird, as powerline symbols are not transparent, but the background of statusline segments are.

An alternative may be to only make one color or some colors transparent. For example, if only background color is made transparent (which also matches the behavior of many terminal emulators), the whole statusline becomes fully opaque, and powerline symbols have the same colors as statusline segments.

zadirion commented 1 year ago

Hello, what is the status of this at the moment? Would be nice to have

oblivcheck commented 12 months ago

Hello, what is the status of this at the moment? Would be nice to have

this patch is valid in the latest version.

For me: there was a problem with the window border.

2023-11-08_1455x1337

I think this is a render issue with neovim/cli, but that doesn't explain why this doesn't happen on the left/top. (In the screenshot, I'm using nvim-qt instead of cli)

thin black lines are due to the screenshot, just pay attention to the edge of the window.

NetherFolk commented 2 months ago

@jgehrig

It looks like this can be accomplished with Qt...

Here is a very quick-and-hacky patch: background_only_transparency.txt

image

I'm not sure if the additional complexity is worth it. To me, it looks quite similar to full-window :GuiWindowOpacity.

Maybe someone who want this feature can create a Pull Request with improved code and do the necessary testing on each platforms?

Hello, how do I apply this patch? I tried putting it into ginit.vim but it didn't work.