feat(render): support pseudo-transparency#595
Conversation
|
@jaagr any comments? |
|
@beenofs sorry for my extreme delay. I have a few comments, will open up a review as soon as I can. |
|
@jaagr no problem, take your time. Just wanted to make sure this didn't get lost, as I often forget about PRs myself when I only take a short look at them and then github notification is gone ☺ |
|
This feature is currently not compatible with a bottom aligned bar. |
|
@lmoesch oh? what happens in that case? i had assumed that |
|
The background area is still copied from the top of the background, not the bottom. I tried to modify the values of "copy_area_checked" within the background_manager wich did the trick. So basically we need to get the corner point information to that function. |
|
@lmoesch background_manager stores a |
299f371 to
bfb1539
Compare
|
@lmoesch should be fixed with last commit. (needed to use |
|
Splendid, that worked like a charm! Thanks for the quick fix 👍 |
|
While fiddeling arround with some parameters I came across other bugs. First thing is, that the offset of a border is not taken into account while calculating the background snippet. Unfortunately I have just few to no knowledge about X-Server classes and behaviour, but I assume that a border is also drawn by a rectangle which gets overdrawn by the content. So to fix this one I guess it is sufficient to replace the bar rectangle with the border rectangle. Other thing is a trickey one. When using multiple bars ontop of each other, background location also fails due to the offset to each other. (e.g. if you have two bars on top, then both will have the background of the most upper one) |
|
Borders work correctly now: (this is a semi-transparent border at top) Have to look into the "multipe bars stacked" issue. |
92b001b to
dd3b100
Compare
|
Btw, I am not sure anymore what I originally meant by "Cleanup tray changes" |
b0ad437 to
ae10bb7
Compare
|
Rebased against latest master |
NBonaparte
left a comment
There was a problem hiding this comment.
It looks like it mostly works. I've tested with borders and it functions correctly, except for the tray which does not function properly (gives a solid color). I have not tried stacking trays yet.
From what I see pseudo-transparency is always used including with compositors; I'm assuming you're planning to create some detection method?
|
|
||
| xcb_visualtype_t* m_visual = nullptr; | ||
| xcb_gcontext_t m_gcontext = XCB_NONE; | ||
| xcb_pixmap_t m_pixmap = XCB_NONE; |
There was a problem hiding this comment.
For these as well as m_attached could you use brace initialization to be consistent with the rest of the code?
| switch (tag) { | ||
| case 'B': | ||
| m_sig.emit(change_background{parse_color(value, bar.background)}); | ||
| m_sig.emit(change_background{parse_color(value, 0x0)}); |
There was a problem hiding this comment.
This is because 0 specifes "fully transparent": the bar background is now handled in the renderer by compositing everything on top of a surface filled with the background using cairo. So to use "background color" we can simply use "transparent".
|
Thanks for the review! I have changed to using brace initialization. The tray works fine for me, but alpha support in the tray is dependent on the tray icon having alpha channel I think. What program have you tried, maybe it is specific to that program that it does not work (does it work if using a compositor)? I am using Yes we need a detection method. I will look into that. But with the changes, it should be pretty easy to turn of the pseudo-transparency if there is a compositor: right now, we fill the surface with the desktop background as a first step and then paint everything on top of that, using cairo's support for transparency. If we have a compositor, we can simply drop the first step and paint the window fully transparent, everything else should keep working. |
|
I've tried |
|
@NBonaparte hmm, if I use the example config and change |
|
It works for me even when using |
|
I tried with and without |
|
What window manager, desktop, distribution are you using? You're using the default config except for changing the background color, right? I can't reproduce this here. |
|
Hmm, are you setting a background image? I use |
|
Awesome! I think we're done. I'm going to wait a week on NBonaparte's for feedback but after that we'll merge this. |
|
After only 17 months we have finally merged this! @bennofs, thank you so much for all your hard work, we really appreciate it. This is a really exciting feature to have! Would you be available to help out if problems arise with this feature? |
|
Thanks! You can ping me in any issues related to this. |
|
Awesome! Let's hope we won't need to ;) |
|
@patrick96 @bennofs Finally, congratulations. |
|
Thank you so much for this! |
|
Thank you guys for your work! |
|
Thank you so much for this!! @bennofs you are amazing! |
### Breaking Changes: None ### Changelog **New Config Options** The following config options were added In the `[settings]` section: * `pseudo-transparency` In `internal/cpu`: * `ramp-coreload-spacing`, spacing between elements in `<ramp-coreload>` elements * `%percentage-sum%` in `label`. Shows sum of all percentages In `custom/script`: * `double-click-left` * `double-click-middle` * `double-click-right` In `internal/pulseaudio`: * `interval`, volume increase and decrease steps in percentage points In `internal/memory`: * `bar-swap-used` * `bar-swap-free` * `ramp-swap-used` * `ramp-swap-free` **Deprecations** * `tray-transparent` in the bar section is no longer used. The tray now always uses pseudo-transparency **Features** * volume: adjustable volume steps (#1364), see #1361 * memory: Add progress bars and ramps for swap (#1325) * render: pseudo-transparency (always used in the tray) (#595) * cpu: * Configurable spacing in between coreloads (#1472), see #1389 * Non-normalized cpu load (#1517), see #1516 * script: Double click actions (#1442) * net: Support for bridge interfaces (#1528), see #1522 * token: zero pad tokens when min-width value starts with a `0` (#1341), see #1332 **Fixes** * config: Use font patterns detected on system in sample config (#1350) * net: Disconnected module when SSID is only an emoji (#1371), see #1367 * tray: Tray overlapping with bar (#1392), see #591 * build: Several build errors (#1395, #1454, #1470, polybar/xpp#12, #1493), see #1447, #1469, #750, #1492 * mpd: format-online-prefix not working (#1402), see #1399 * font: Crash for some font-patterns (#1451), see #1435 * script: * Only `%counter%` or `%pid%` token usable, never both (#1456) * click actions with colons in them (#1457), see #984 * renderer: Bar locks up when xorg composite extension is disabled (#1430), see #1425
|
Can confirm. @bennofs any idea how to fix this? I was able to get transparency back by adding the offset to both the x and y arguments here ( |
|
I will look into this when I have time (probably right after new year, possibly earlier) |
|
No rush :) |
The example file seems to have gone away. Can you restore it / upload to github? |
|
@bennofs Also, here's a config with which I can reproduce the issue: [bar/example]
width = 90%
height = 40
radius = 20.0
bottom = true
background = #99000000
foreground = #dfdfdf
border-size = 4
border-color = #dd000000
padding-left = 0
padding-right = 2
modules-left = title
tray-position = right
tray-padding = 2
tray-background = ${self.background}
tray-offset-x = 20
tray-offset-y = -20
[module/title]
type = internal/xwindow
[settings]
pseudo-transparency = true
; vim:ft=dosini |
|
Ok. What exactly is the intended behaviour of that? The space that is "left over" due to the x/y movement should be filled with the bar's background as well? |
|
I think the intended behavior should be that the whole tray has a transparent background even the parts that do not overlap the bar window. I think the gap that the tray leaves doesn't need to be filled. |
|
Should be fixed by #1571 |





Changelog Note:
This deprecates the
tray-transparentkey and adds thesettings.pseudo-transparencykey.The tray always uses pseudo-transparency, while the bar only uses it when activated.
/Changelog Note
This adds pseudo-transparency for the background of the bar and the
background of the systray.
Here's how it lools (systray is on the right edge, after the power symbol):
I've submitted the PR now to get some feedback on the general implementation, there's still a few small cleanup tasks to do:
Fixes #382