From 8e3c4e4383be1c5a0b31ec646ad0497abdd79d26 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Wed, 18 Feb 2026 15:03:07 +0100 Subject: [PATCH] cava colorizer --- bin/cavactl | 22 ++++++++-------------- bin/colorizer-cava | 29 ++++++++--------------------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/bin/cavactl b/bin/cavactl index 1d886ee..f7a9f03 100755 --- a/bin/cavactl +++ b/bin/cavactl @@ -12,20 +12,20 @@ pkill -USR2 cava > /dev/null 2>&1 } mode() { case "$1" in - solid) sd ".*gradient .*" "gradient = 0" ${CFGFILE};; - gradient) sd ".*gradient .*" "gradient = 1" ${CFGFILE};; + solid) sd "^gradient .*" "gradient = 0" ${CFGFILE};; + gradient) sd "^gradient .*" "gradient = 1" ${CFGFILE};; esac #reload_colors reload_config } foregroundcolor(){ - sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE} + sd "^foreground .*" "foreground = '${1}'" ${CFGFILE} } foreground() { -sd ".*foreground .*" "foreground = '${1}'" ${CFGFILE} -sd ".*gradient .*" "gradient = 0" ${CFGFILE} +sd "^foreground .*" "foreground = '${1}'" ${CFGFILE} +sd "^gradient .*" "gradient = 0" ${CFGFILE} reload_config } gradientcolors() { @@ -73,13 +73,8 @@ sd "^framerate .*" "framerate = ${1}" ${CFGFILE} reload_config } -sensitivity () { -sd "^sensitivity .*" "sensitivity = ${1}" ${CFGFILE} -reload_config -} - -gravity () { -sd "^gravity .*" "gravity = ${1}" ${CFGFILE} +noise_reduction () { +sd "^noise_reduction .*" "noise_reduction = ${1}" ${CFGFILE} reload_config } @@ -123,8 +118,7 @@ case "$1" in bar_width)bar_width "$2";; bar_spacing)bar_spacing "$2";; framerate)framerate "$2";; - sensitivity)sensitivity "$2";; - gravity)gravity "$2";; + noise_reduction)noise_reduction "$2";; resetcfg)resetcfg;; info) info;; *):;; diff --git a/bin/colorizer-cava b/bin/colorizer-cava index 43836a2..09bc87c 100755 --- a/bin/colorizer-cava +++ b/bin/colorizer-cava @@ -63,9 +63,7 @@ case "$LANG" in MODGRAD_TO="Gradient kolor 2" _GENERAL="Ogólne" _FRAMERATE="Ramki (fps)" - _SENSITIVITY="Czułość" - _SENSDESC="wpływa na wysokość" - _GRAVITY="Grawitacja" + _NOISE_RED="Redukcja szumów" _RESETCFG="Resetuj konfigurację" EDITCONF="Edytuj plik konfiguracyjny" RELOAD="Przeładuj konfigurację" @@ -93,9 +91,7 @@ case "$LANG" in MODGRAD_TO="Modify Gradient To" _GENERAL="General" _FRAMERATE="Framerate" - _SENSITIVITY="Sensitivity" - _SENSDESC="affects bar height" - _GRAVITY="Gravity" + _NOISE_RED="Noise reduction" _RESETCFG="Reset config to default" EDITCONF="Edit config file" RELOAD="Reload config" @@ -105,8 +101,7 @@ case "$LANG" in esac getvalues () { -read SENS <<< "$(grep '^sensitivity ' ${CFGFILE} | cut -d"=" -f2)" -read GRAV <<< "$(grep '^gravity ' ${CFGFILE} | cut -d"=" -f2)" +read NOISE_RED <<< "$(grep '^noise_reduction ' ${CFGFILE} | cut -d"=" -f2)" read FPS <<< "$(grep '.*framerate ' ${CFGFILE} | cut -d"=" -f2)" read FG <<< "$(grep '.*foreground ' ${CFGFILE} | cut -d"'" -f2)" @@ -165,23 +160,15 @@ FGT=$(pastel textcolor ${FGC}|pastel format hex) [[ "$FPS" == "$i" ]] && out2+=(" $i,cavactl framerate $i;$me") || out2+=(" $i,cavactl framerate $i;$me") done - out+=("$_SENSITIVITY [ $SENS ],^checkout(sens)") + out+=("$_NOISE_RED [ $NOISE_RED ],^checkout(sens)") out2+=("^tag(sens)") - out2+=("^sep($_SENSITIVITY)") - out2+=("^sep($_SENSDESC)") - for i in 100 50 25 + out2+=("^sep($_NOISE_RED)") + for i in 90 77 50 25 do - [[ "$SENS" == "$i" ]] && out2+=(" $i,cavactl sensitivity $i;$me") || out2+=(" $i,cavactl sensitivity $i;$me") - done - - out+=("$_GRAVITY [ $GRAV ],^checkout(grav)") - out2+=("^tag(grav)") - out2+=("^sep($_GRAVITY)") - for i in 999 400 200 100 50 - do - [[ "$GRAV" == "$i" ]] && out2+=(" $i,cavactl gravity $i;$me") || out2+=(" $i,cavactl gravity $i;$me") + [[ "$NOISE_RED" == "$i" ]] && out2+=(" $i,cavactl noise_reduction $i;$me") || out2+=(" $i,cavactl noise_reduction $i;$me") done + out+=("^sep()") out+=(" $EDITCONF,xdg-open ~/.config/cava/config")