added several tools for nvim

This commit is contained in:
liph22
2025-12-20 19:51:55 +01:00
parent bb05a90ee9
commit 381dda3e7a
9 changed files with 77 additions and 18 deletions

View File

@@ -9,10 +9,10 @@ mkdir -p "$SHADER_DIR"
# Check if shader file exists, if not create with default brightness
if [ ! -f "$SHADER_FILE" ]; then
CURRENT=1.0
CURRENT=1.0
else
# Get current brightness multiplier
CURRENT=$(grep -oP 'pixColor.rgb \*= \K[0-9.]+' "$SHADER_FILE" | tail -1)
# Get current brightness multiplier
CURRENT=$(grep -oP 'pixColor.rgb \*= \K[0-9.]+' "$SHADER_FILE" | tail -1)
fi
# Calculate new brightness (decrease by 10%)
@@ -20,7 +20,7 @@ NEW=$(echo "$CURRENT * 0.90" | bc -l)
# Cap at 0.1 to prevent complete darkness
if (( $(echo "$NEW < 0.1" | bc -l) )); then
NEW=0.1
NEW=0.1
fi
# Format to 2 decimal places
@@ -29,7 +29,7 @@ NEW=$(printf "%.2f" "$NEW")
# Check if blue light filter is currently enabled
BLUELIGHT_ENABLED=false
if [ -f "$SHADER_FILE" ] && grep -q "pixColor.b \*= 0.6" "$SHADER_FILE"; then
BLUELIGHT_ENABLED=true
BLUELIGHT_ENABLED=true
fi
# Recreate the shader file
@@ -44,30 +44,30 @@ uniform sampler2D tex;
void main() {
vec4 pixColor = texture(tex, v_texcoord);
EOF
if [ "$BLUELIGHT_ENABLED" = true ]; then
cat >> "$SHADER_FILE" << EOF
cat >> "$SHADER_FILE" << EOF
// Reduce blue light
pixColor.r *= 1.0;
pixColor.g *= 0.85;
pixColor.b *= 0.6;
EOF
fi
cat >> "$SHADER_FILE" << EOF
// Adjust brightness
pixColor.rgb *= $NEW;
fragColor = pixColor;
}
EOF
# Apply shader
if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1)
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1)
fi
/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE"