picom: use a wrapper script to template picom configuration file

This commit is contained in:
Vincent Bernat 2021-11-02 10:12:56 +01:00
parent 9371fff442
commit 3770929742
5 changed files with 20 additions and 5 deletions

13
bin/picom-configure Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh -e
DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
POLYBAR_HEIGHT=$((20 * DPI / 96))
# Configure picom
cat ~/.config/i3/dotfiles/picom.conf \
| sed -e "s/@POLYBAR_HEIGHT@/$POLYBAR_HEIGHT/" \
> $XDG_RUNTIME_DIR/i3/picom.conf.new
# Put new configuration file in place
cmp $XDG_RUNTIME_DIR/i3/picom.conf.new $XDG_RUNTIME_DIR/i3/picom.conf 2> /dev/null || \
mv $XDG_RUNTIME_DIR/i3/picom.conf.new $XDG_RUNTIME_DIR/i3/picom.conf