picom: compute an offset for shadows

This commit is contained in:
Vincent Bernat 2021-11-02 13:29:31 +01:00
parent d5dbb906b4
commit 100a23fb03
2 changed files with 5 additions and 3 deletions

View file

@ -4,11 +4,13 @@ dpi=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
POLYBAR_HEIGHT=$((20 * dpi / 96))
SHADOW_RADIUS=$((12 * dpi / 96))
SHADOW_OFFSET=$((SHADOW_RADIUS*2/3))
# Configure picom
cat ~/.config/i3/dotfiles/picom.conf \
| sed -e "s/@POLYBAR_HEIGHT@/$POLYBAR_HEIGHT/" \
| sed -e "s/@SHADOW_RADIUS@/$SHADOW_RADIUS/" \
| sed -e "s/@SHADOW_OFFSET@/$SHADOW_OFFSET/" \
> $XDG_RUNTIME_DIR/i3/picom.conf.new
# Put new configuration file in place

View file

@ -37,10 +37,10 @@ opacity-rule = [
# Shadow and fading
fade-in-step = 0.08;
fade-out-step = 0.08;
shadow-opacity = 0.5;
shadow-opacity = 1;
shadow-radius = @SHADOW_RADIUS@;
shadow-offset-x = 0;
shadow-offset-y = 0;
shadow-offset-x = -@SHADOW_OFFSET@;
shadow-offset-y = -@SHADOW_OFFSET@;
shadow-exclude-reg = "x@POLYBAR_HEIGHT@+0+0"
wintypes:
{