From 48abe47cfb19b074fc252204db669b4375f26260 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 11 Sep 2024 08:26:53 +0200 Subject: [PATCH] picom: just set a small corner-radius --- bin/picom-configure | 2 ++ dotfiles/picom.conf | 3 +-- dotfiles/rounded-borders.glsl | 42 ----------------------------------- 3 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 dotfiles/rounded-borders.glsl diff --git a/bin/picom-configure b/bin/picom-configure index aacb8c8..84ed336 100755 --- a/bin/picom-configure +++ b/bin/picom-configure @@ -5,6 +5,7 @@ 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)) +CORNER_RADIUS=$((4 * dpi / 96)) # Configure picom mkdir -p $XDG_RUNTIME_DIR/i3 @@ -12,6 +13,7 @@ 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/" \ + | sed -e "s/@CORNER_RADIUS@/$CORNER_RADIUS/" \ > $XDG_RUNTIME_DIR/i3/picom.conf.new # Put new configuration file in place diff --git a/dotfiles/picom.conf b/dotfiles/picom.conf index 05cd71e..0e1f534 100644 --- a/dotfiles/picom.conf +++ b/dotfiles/picom.conf @@ -68,5 +68,4 @@ shadow-exclude = [ ]; fade-exclude = [ ]; -corner-radius = @SHADOW_RADIUS@ -window-shader-fg = "rounded-borders.glsl" +corner-radius = @CORNER_RADIUS@ diff --git a/dotfiles/rounded-borders.glsl b/dotfiles/rounded-borders.glsl deleted file mode 100644 index f627acc..0000000 --- a/dotfiles/rounded-borders.glsl +++ /dev/null @@ -1,42 +0,0 @@ -#version 330 - -in vec2 texcoord; -uniform sampler2D tex; -uniform float corner_radius; - -vec4 default_post_processing(vec4 c); - -vec4 add_rounded_corners( - vec4 win_color, - vec2 tex_coord, - vec2 tex_size, - float radius, - float thickness) -{ - // If we're far from corners, we just pass window texels through - vec2 corner_distance = min(abs(tex_coord), abs(tex_size - 1 - tex_coord)); - if (any(greaterThan(corner_distance, vec2(radius)))) - return win_color; - - // Distance from the closest arc center - vec2 center_distance = min( - abs(vec2(radius) - tex_coord), - abs(vec2(tex_size - radius) - tex_coord)); - - // Do some simple anti-aliasing - float inner_radius = radius - thickness; - float feather = 1 / inner_radius; - float r = length(center_distance) / inner_radius; - float blend = smoothstep(1, 1 + feather, r); - - vec4 border_color = texture2D(tex, vec2(0), 0); - return blend * border_color + (1.0 - blend) * win_color; -} - -vec4 window_shader() -{ - vec2 tex_size = textureSize(tex, 0); - vec4 c = texture2D(tex, texcoord / tex_size, 0); - vec4 with_corners = add_rounded_corners(c, texcoord, tex_size, corner_radius, 6); - return default_post_processing(with_corners); -}