Git Product home page Git Product logo

Comments (20)

Barbaross93 avatar Barbaross93 commented on August 17, 2024 1

Hey @cullyn-inverba sorry I never got back to you on reddit. I was busy with finals and your message completely slipped past me. The best thing to do would be to make a separate file copying and pasting that patch into a chwb2.patch file. Then, do patch < chwb2.patch in the git directory (the patch file has to be in the directory as well). It should apply the patch to chwb2.c and you should then be able to compile it and run it. Windows with transparency properties should now have opaque borders. Try googling "how to use the patch command" or read the patch man page for more info.

@z3bra It's been awhile, do you have any further thoughts on this? It would be fantastic to see this merged.

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024 1

Alright the following diff works perfectly:

diff --git a/chwb2.c b/chwb2.c
index db75a0f..1ee3554 100644
--- a/chwb2.c
+++ b/chwb2.c
@@ -59,6 +59,11 @@ int is; /* inner size  */
 	if (is + os > geom->border_width)
 		warnx("warning: pixmap is greater than border size");
 
+	oc |= 0xff << 24;
+	os |= 0xff << 24;
+	ic |= 0xff << 24;
+	is |= 0xff << 24;
+
 	w = (short)geom->width;
 	h = (short)geom->height;
 	b = (unsigned short)is+os;

This basically sets the border color to ff (no transparency). Do we want to have separate command line options to set the specified border opacity @z3bra ? This explains why forcing the border through the command line options doesn't work as the transparency is not shifted by 24 if e.g. the color is 0x111111 and we set it to 0xff111111

Hello, I using Barbarossa93's script that sues chwb2 to draw double borders and running into same issue. Zathura's borders are transparent. Looks like this worked for him, but I'm not too sure how to apply this patch. Mind telling me how? Thanks.

12-23-20__22:12:06

Also seems to affect the background of Zathura, if that helps. I also tired the above suggestions relating to picom config with no luck. I'm not really sure how chwb2 works at all, so excuse my ignorance.

You can use my branch https://github.com/jwijenbergh/opt/tree/fix-transparency-chwb2
Sorry I didn't see your reply before.

Hey @cullyn-inverba sorry I never got back to you on reddit. I was busy with finals and your message completely slipped past me. The best thing to do would be to make a separate file copying and pasting that patch into a chwb2.patch file. Then, do patch < chwb2.patch in the git directory (the patch file has to be in the directory as well). It should apply the patch to chwb2.c and you should then be able to compile it and run it. Windows with transparency properties should now have opaque borders. Try googling "how to use the patch command" or read the patch man page for more info.

@z3bra It's been awhile, do you have any further thoughts on this? It would be fantastic to see this merged.

Thanks for commenting!

Indeed, hopefully @z3bra agrees so we can merge the changes. I don't really use this all the time but afaik my branch now should work as expected.

from opt.

nosvagor avatar nosvagor commented on August 17, 2024 1

Excellent. Thanks for the help guys! Didn't use your branch @jwijenbergh, mostly because I wanted to learn how to use the patch, but I would have if it was harder than what it ended up being.

from opt.

z3bra avatar z3bra commented on August 17, 2024

from opt.

Barbaross93 avatar Barbaross93 commented on August 17, 2024

from opt.

z3bra avatar z3bra commented on August 17, 2024

from opt.

Barbaross93 avatar Barbaross93 commented on August 17, 2024

Hmm, bummer. Thanks for suggestions at least! I'll mess around with picom's settings and see if I can get anything to work. @jwijenbergh I assume everything is working for you? Do you use picom/compton? I'd be curious to see your config file.

from opt.

Barbaross93 avatar Barbaross93 commented on August 17, 2024

Small update: apparently setting the alpha value to 50% in above with chwb2 when picom is not running also doesn't work; seems to imply that there is either a problem with chwb2 or bspwm

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

Hmm, bummer. Thanks for suggestions at least! I'll mess around with picom's settings and see if I can get anything to work. @jwijenbergh I assume everything is working for you? Do you use picom/compton? I'd be curious to see your config file.

I do not use transparency, so this is not a problem for me. See the following picom settings:

inactive-opacity = 1;
active-opacity = 1;
frame-opacity = 1;

If you indeed use transparency, there can be some problems (forcing transparency prefix 0xff doesn't seem to work either). Is that zathura you're using on the left? I will investigate this further

update:

Even with transparency turned off, I see issues with applications such as zathura and some emulators like alacritty (exactly like your screenshot). You can notice that this issue is not there when you have only instances of e.g. st without the alpha patch. I will see what is the best solution here, as going back to drawing with the root window causes the border to not draw at all.

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

Alright the following diff works perfectly:

diff --git a/chwb2.c b/chwb2.c
index db75a0f..1ee3554 100644
--- a/chwb2.c
+++ b/chwb2.c
@@ -59,6 +59,11 @@ int is; /* inner size  */
 	if (is + os > geom->border_width)
 		warnx("warning: pixmap is greater than border size");
 
+	oc |= 0xff << 24;
+	os |= 0xff << 24;
+	ic |= 0xff << 24;
+	is |= 0xff << 24;
+
 	w = (short)geom->width;
 	h = (short)geom->height;
 	b = (unsigned short)is+os;

This basically sets the border color to ff (no transparency). Do we want to have separate command line options to set the specified border opacity @z3bra ? This explains why forcing the border through the command line options doesn't work as the transparency is not shifted by 24 if e.g. the color is 0x111111 and we set it to 0xff111111

from opt.

Barbaross93 avatar Barbaross93 commented on August 17, 2024

Thanks for responding! Indeed, that is zathura in the screenshot. I tried disabling transparency/opacity in picom and the problem persists. I see a similar effect with zoom as well, but I haven't tried other programs with known alpha windows. Urxvt has a color depth option that when set to 32 I see the problem, but it stops when I revert it back to 24.

update: I'll try your patch, just saw it as I posted this reply!

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

Thanks for responding! Indeed, that is zathura in the screenshot. I tried disabling transparency/opacity in picom and the problem persists. I see a similar effect with zoom as well, but I haven't tried other programs with known alpha windows. Urxvt has a color depth option that when set to 32 I see the problem, but it stops when I revert it back to 24.

update: I'll try your patch, just saw it as I posted this reply!

no problem! Sorry for editing and posting my comments a bunch of times, I was testing and posting as I went along haha

from opt.

Barbaross93 avatar Barbaross93 commented on August 17, 2024

No problem! Your patch works flawlessly! Hopefully we will hear from @z3bra soon. It does make sense to add a command line option. However, picom does have the frame-opacity option, so it may not be needed (it works with your patch!).

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

No problem! Your patch works flawlessly! Hopefully we will hear from @z3bra soon. It does make sense to add a command line option. However, picom does have the frame-opacity option, so it may not be needed (it works with your patch!).

Oh that makes a lot of sense then to just leave it as my patch and the opacity can then always be changed with picom. I will make a pr for the patch if @z3bra agrees

from opt.

z3bra avatar z3bra commented on August 17, 2024

Given that the previous patch enabled transparency, that would be counter productive to then reset the alpha channel to 0xff. We'd better revert the previous patch in this case !

I wouldn't mind an option. As I said, I don't use chwb2 myself. Adding a flag for transparency would work. Maybe make it fully opaque by default, so we keep the old behavior unchanged.

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

Given that the previous patch enabled transparency, that would be counter productive to then reset the alpha channel to 0xff. We'd better revert the previous patch in this case !

Without the previous patch (#47), chwb2 does not change the border appearance when it tries to draw on an application such as zathura or alacritty (applications which handle the alpha channel, which with the updated patch now draw the incorrect opacity instead of not drawing at all). Reverted would make things worse. The way my diff now does is, is the exact same how dwm fixes the transparency issue when used in combination with the alpha patch:
https://dwm.suckless.org/patches/alpha/dwm-fixborders-6.2.diff

By setting the alpha channel to ff, the border now correctly uses picom's frame-opacity setting. So if the compositor sets the border opacity to 0.5, it sets it to that correctly (even thought chwb2 sets it to ff).

So I think how it stands right now is the correct way (with my new diff), as it is weird to have a transparent border when a user has set their opacity to 1.

On first glance it might seem counter-intuitive. But now that we are using the client's depth we need to handle opacity/transparency correctly which should be all fine with the newest diff. Now borders are drawn correctly for all applications (that I tested) and with a compositor either on or off.

from opt.

z3bra avatar z3bra commented on August 17, 2024

What is the point of using the client depth then ?

from opt.

jwijenbergh avatar jwijenbergh commented on August 17, 2024

What is the point of using the client depth then ?

I mentioned this in my last comment and #47, but I will give a more detailed explanation here.

Root depth doesn't work for terminal emulators such as termite or alacritty and some other applications.

To reproduce the issue with root depth do the following (with or without compositor):

  • Open termite or alacritty
  • Apply border with chwb2 -I 'ffffff' -O '282828' -i 2 -o 6 "$(pfw)" (and border is set to 8px in the wm)
  • Nothing happens, the border remains the same as set by the wm

When using client's depth the border is set correctly. We do have to fix transparency (when using a compositor), which is what I have done. Please reproduce the issue with root depth to see what I mean.

from opt.

nosvagor avatar nosvagor commented on August 17, 2024

Alright the following diff works perfectly:

diff --git a/chwb2.c b/chwb2.c
index db75a0f..1ee3554 100644
--- a/chwb2.c
+++ b/chwb2.c
@@ -59,6 +59,11 @@ int is; /* inner size  */
 	if (is + os > geom->border_width)
 		warnx("warning: pixmap is greater than border size");
 
+	oc |= 0xff << 24;
+	os |= 0xff << 24;
+	ic |= 0xff << 24;
+	is |= 0xff << 24;
+
 	w = (short)geom->width;
 	h = (short)geom->height;
 	b = (unsigned short)is+os;

This basically sets the border color to ff (no transparency). Do we want to have separate command line options to set the specified border opacity @z3bra ? This explains why forcing the border through the command line options doesn't work as the transparency is not shifted by 24 if e.g. the color is 0x111111 and we set it to 0xff111111

Hello, I am using Barbarossa93's script that uses chwb2 to draw double borders and running into same issue. Zathura's borders are transparent. Looks like this worked for him, but I'm not too sure how to apply this patch. Mind telling me how? Thanks.

12-23-20__22:12:06

Also seems to affect the background of Zathura, if that helps. I also tired the above suggestions relating to picom config with no luck. I'm not really sure how chwb2 works at all, so excuse my ignorance.

from opt.

z3bra avatar z3bra commented on August 17, 2024

Let it be fantastic then !

from opt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.