picom icon indicating copy to clipboard operation
picom copied to clipboard

fix shadow for rounded window

Open s0nny7 opened this issue 4 years ago • 17 comments
trafficstars

Sorry for the mess, it took me a whole branch to figure out how to properly squash and merge my commits.

I've combined all my changes into this pull request, hope it helps.

s0nny7 avatar Jun 09 '21 09:06 s0nny7

I’m not sure why (perhaps tabbing / alignment) but your commit wishes to replace lines 191-254 instead of just adding the lines at ~200, don’t worry about fixing it I’ll just add it manually.

ibhagwan avatar Jun 09 '21 16:06 ibhagwan

I’m not sure why (perhaps tabbing / alignment) but your commit wishes to replace lines 191-254 instead of just adding the lines at ~200, don’t worry about fixing it I’ll just add it manually.

Guess it's because I changed the painting process, the shadow painting part is moved before the blur part. (to deal with the sharp corner generated by blurring)

s0nny7 avatar Jun 10 '21 01:06 s0nny7

I did clone this fix, and for me, it did not work with transparent windows. You can see the red shadow behind the transparent windows.

shadow = true;
shadow-red = 80;

image

victor-timofei avatar Jun 29 '21 16:06 victor-timofei

I don't get it. This fix is for filling the gap between rounded window corner and squared shadow, since the original version generates the shadow for rectangle shape, which does not match the rounded window.

I don't think it has something to do with shadow under the window, could you please explain the problem in details?

btw. Nice look. I didn't know the color of the shadow can be changed like that.

s0nny7 avatar Jul 01 '21 14:07 s0nny7

image image

Works for me! I can't tell whether the shadow bleeds underneath the window so it's not a big issue for me. Thanks for your PR, I hope this can be merged soon!

reeseovine avatar Sep 03 '21 17:09 reeseovine

I'm still a bit weary of making changes to this fork since it's used by so many and who knows what kind of other issues this might cause, maybe it's better I just create a feature branch and people can test it out?

ibhagwan avatar Sep 03 '21 17:09 ibhagwan

image image

Works for me! I can't tell whether the shadow bleeds underneath the window so it's not a big issue for me. Thanks for your PR, I hope this can be merged soon!

wait.... how did you make the shadow come out from all sides ?

frak0d avatar Sep 23 '21 06:09 frak0d

I'm wondering what this PR fixes after all -- the shadows are rounded on the main branch iirc already?!

scrouthtv avatar Sep 23 '21 06:09 scrouthtv

wait.... how did you make the shadow come out from all sides ?

@Tanishq-Banyal it took a bit of trial and error getting the positioning right. here's the relevant section of my picom.conf:

shadow = true;
shadow-radius = 17;
shadow-offset-x = -17;
shadow-offset-y = -12;
shadow-opacity = 0.25;

reeseovine avatar Sep 23 '21 20:09 reeseovine

I'm wondering what this PR fixes after all -- the shadows are rounded on the main branch iirc already?!

@scrouthtv see #3.

reeseovine avatar Sep 23 '21 20:09 reeseovine

I'm still a bit weary of making changes to this fork since it's used by so many and who knows what kind of other issues this might cause, maybe it's better I just create a feature branch and people can test it out?

I agree 👍. I would like this to be merged into the new branch with the latest picom upstream commits as well. And this is the only thing stopping me from using shadows.

godalming123 avatar Jan 12 '22 17:01 godalming123

Does this fork actually make the shadows rounded? If so, am I missing something? I installed it and nothing seemed to have changed.

ljmill avatar Aug 20 '22 09:08 ljmill

It does make the shadows rounded but you need to turn on the rounded window option in your config

godalming123 avatar Aug 20 '22 14:08 godalming123

It does make the shadows rounded but you need to turn on the rounded window option in your config

Was there a specific option for that other than corner-radius? I re-built and installed this fork and my shadows are still rectangular. Here is my config

#################################
#             Corners           #
#################################
corner-radius = 10.0;
rounded-corners-exclude = [
  #"window_type = 'normal'",
  "class_g = 'awesome'",
  "class_g *?= 'eww'"
];
round-borders = 1;

#################################
#             Shadows           #
#################################
shadow = true;
shadow-radius = 0;
shadow-opacity = 1.0;
shadow-offset-x = 8;
shadow-offset-y = 8;

#################################
#           Fading              #
#################################
fading = true;
fade-in-step = 0.09;
fade-out-step = 0.09;
fade-exclude = [
  "class_g = 'slop'" 
]
no-fading-openclose = false

#################################
#   Transparency / Opacity      #
#################################
inactive-opacity = 0.8;
frame-opacity = 0.7;
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
inactive-opacity-override = false;
active-opacity = 1.0;
focus-exclude = [
  "class_g = 'Cairo-clock'",
  "class_g = 'Bar'",   
  "class_g = 'slop'" 
];
opacity-rule = [
  "80:class_g     = 'Bar'", 
  "100:class_g    = 'slop'", 
  "100:class_g    = 'XTerm'",
  "100:class_g    = 'URxvt'",
  "100:class_g    = 'kitty'",
  "100:class_g    = 'Alacritty'",
  "100:class_g    = 'code-oss'",
  "100:class_g    = 'Meld'",
  "70:class_g     = 'TelegramDesktop'",
  "90:class_g     = 'Joplin'",
  "100:class_g    = 'firefox'",
  "100:class_g    = 'Thunderbird'",
  #"90:class_g     = 'Thunar'",
  #"50:class_g = 'Bspwm' && class_i = 'presel_feedback'"
];

#################################
#     Background-Blurring       #
#################################
blur: {
  method = "dual_kawase";
  strength = 3;
  background = false;
  background-frame = false;
  background-fixed = false;
  kern = "3x3box";
}
blur-background-exclude = [
  "window_type = 'dock'",
  "window_type = 'widget'",
  "class_g = 'slop'",
  "class_g = 'polybar'",
  "class_g *?= 'eww'",
  "class_g *?= 'firefox'",
  "_GTK_FRAME_EXTENTS@:c"
];

#################################
#       General Settings        #
#################################
experimental-backends = true;
backend = "glx";
vsync = true
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0
detect-transient = true
detect-client-leader = true
use-damage = false
log-level = "info";

wintypes:
{
  normal = { fade = true; shadow = true; }
  tooltip = { fade = false; shadow = false; opacity = 0.75; focus = true; full-shadow = false; };
  dock = { shadow = false; }
  dnd = { shadow = false; }
  popup_menu = { opacity = 0.9; }
  dropdown_menu = { opacity = 0.8; }
};

ljmill avatar Aug 20 '22 16:08 ljmill

It does make the shadows rounded but you need to turn on the rounded window option in your config

Was there a specific option for that other than corner-radius? I re-built and installed this fork and my shadows are still rectangular. Here is my config

#################################
#             Corners           #
#################################
corner-radius = 10.0;
rounded-corners-exclude = [
  #"window_type = 'normal'",
  "class_g = 'awesome'",
  "class_g *?= 'eww'"
];
round-borders = 1;

#################################
#             Shadows           #
#################################
shadow = true;
shadow-radius = 0;
shadow-opacity = 1.0;
shadow-offset-x = 8;
shadow-offset-y = 8;

#################################
#           Fading              #
#################################
fading = true;
fade-in-step = 0.09;
fade-out-step = 0.09;
fade-exclude = [
  "class_g = 'slop'" 
]
no-fading-openclose = false

#################################
#   Transparency / Opacity      #
#################################
inactive-opacity = 0.8;
frame-opacity = 0.7;
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
inactive-opacity-override = false;
active-opacity = 1.0;
focus-exclude = [
  "class_g = 'Cairo-clock'",
  "class_g = 'Bar'",   
  "class_g = 'slop'" 
];
opacity-rule = [
  "80:class_g     = 'Bar'", 
  "100:class_g    = 'slop'", 
  "100:class_g    = 'XTerm'",
  "100:class_g    = 'URxvt'",
  "100:class_g    = 'kitty'",
  "100:class_g    = 'Alacritty'",
  "100:class_g    = 'code-oss'",
  "100:class_g    = 'Meld'",
  "70:class_g     = 'TelegramDesktop'",
  "90:class_g     = 'Joplin'",
  "100:class_g    = 'firefox'",
  "100:class_g    = 'Thunderbird'",
  #"90:class_g     = 'Thunar'",
  #"50:class_g = 'Bspwm' && class_i = 'presel_feedback'"
];

#################################
#     Background-Blurring       #
#################################
blur: {
  method = "dual_kawase";
  strength = 3;
  background = false;
  background-frame = false;
  background-fixed = false;
  kern = "3x3box";
}
blur-background-exclude = [
  "window_type = 'dock'",
  "window_type = 'widget'",
  "class_g = 'slop'",
  "class_g = 'polybar'",
  "class_g *?= 'eww'",
  "class_g *?= 'firefox'",
  "_GTK_FRAME_EXTENTS@:c"
];

#################################
#       General Settings        #
#################################
experimental-backends = true;
backend = "glx";
vsync = true
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0
detect-transient = true
detect-client-leader = true
use-damage = false
log-level = "info";

wintypes:
{
  normal = { fade = true; shadow = true; }
  tooltip = { fade = false; shadow = false; opacity = 0.75; focus = true; full-shadow = false; };
  dock = { shadow = false; }
  dnd = { shadow = false; }
  popup_menu = { opacity = 0.9; }
  dropdown_menu = { opacity = 0.8; }
};

Unsure, you've set all the potions I had in my config when I used picom. Are your window corners rounded or are they rectangular?

godalming123 avatar Aug 20 '22 17:08 godalming123

Unsure, you've set all the potions I had in my config when I used picom. Are your window corners rounded or are they rectangular?

Yeah. Window corners are rounded. The shadows are not.

window-corner

I really don't know why it wouldn't work. Could you possibly plug my config in and see if you still have rounded corners?

EDIT: when I change my backend to xrender the shadows become rounded. However, the window corners are not rounded on every window. Additionally, it cuts off the border around the rounded corners so it kind of looks bad. Not really sure if this is normal or not.

ljmill avatar Aug 20 '22 18:08 ljmill

Unsure, you've set all the potions I had in my config when I used picom. Are your window corners rounded or are they rectangular?

Yeah. Window corners are rounded. The shadows are not.

window-corner

I really don't know why it wouldn't work. Could you possibly plug my config in and see if you still have rounded corners?

EDIT: when I change my backend to xrender the shadows become rounded. However, the window corners are not rounded on every window. Additionally, it cuts off the border around the rounded corners so it kind of looks bad. Not really sure if this is normal or not.

xrender backend has the same effect for me, not really usable. The one that works sort of better is glx but has an inverse square on semi transparent windows or when windows are fading in/out.

aalvarado avatar Aug 29 '22 17:08 aalvarado